Perhaps will_paginate's counter should ignore :select
Reported by James Coglan | August 1st, 2007 @ 04:29 PM
I'm getting funny results when paginating using the :select option. Not exactly sure why, but
SELECT count(DISTINCT table.id)
returns a lower number than
SELECT count(DISTINCT table.id, table.title, table.body, associated_table.etc)
which is what count() generates when using :select.
I'm attaching a one-line patch. I don't think it screws up any of the tests, or although I had to adjust the set-up of those a little to make them run on MySQL. With this patch, my app is now giving consistent numbers of pages with or without :select, so I can get the speed benefits without dropping records on the floor.
One more thing: wasn't sure whether I should modify this plugin rather than the Rails core, but it's here in case you want it. I'll try fixing it in Rails and see if it works as well.
Comments and changes to this ticket
-
Chris Wanstrath August 1st, 2007 @ 04:29 PM
- State changed from new to resolved
Looks like you're using an old version of will_paginate. Newest revision does ignore :select
Please Sign in or create a free account to add a new ticket.
With your very own profile, you can contribute to projects, track your activity, watch tickets, receive and update tickets through your email and much more.
Create your profile
Help contribute to this project by taking a few moments to create your personal profile. Create your profile ยป