#79 ✓resolved
Chris Wanstrath

include :select if it begins with 'DISTINCT'

Reported by Chris Wanstrath | August 14th, 2007 @ 07:44 PM

I've run into a problem where, for the sake of performance, I'm using :joins rather than :include to find records with a particular association (and no, I can't reverse the situation as I'm looking for several associations at once using 'WHERE field IN (x, y, z...)' and fetching all the associated objects then iterating is even worse) . To avoid duplicates, I'm using a :select => 'DISTINCT blah' but it's not being passed to count() in will_paginate. I know we got rid of the :select option a while back (I ran into the problems it caused myself) but can we include it if it begins with 'DISTINCT'?

I've tested this out in my project and everything works fine, even the bits where :select caused problems before. Unfortunately I can't seem to get sqlite working on my machine so can't test the plugin directly.

- James Coglan

Comments and changes to this ticket

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.

New-ticket Create new ticket

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile ยป

Everyone's favorite Ruby library for pagination of practically anything!

People watching this ticket

Attachments

Pages