binarylogic / searchlogic

Searchlogic provides object based searching, common named scopes, and other useful tools.
http://rdoc.info/projects/binarylogic/searchlogic
MIT License
1.4k stars 133 forks source link

How can I have searchlogic return a DISTINCT value when there are duplicates? #126

Open timfong888 opened 13 years ago

timfong888 commented 13 years ago

I have a searchlogic that searches for not_null on an association that can occur many times, but I only want to display one UNIQUE/DISTINCT instance of the object:

Company.contact_emails_id_not_null

I only want one Company, no matter how many contact_emails are associated to that Company :through => :contacts

concept47 commented 12 years ago

add

:select => 'DISTINCT model.*'

to your eventual query