Return unique rows with finders

I’m looking through the api for something like find(:all, :distinct =>
true)
so that multiple instances of a row won’t be returned - is this
possible?

Thanks!

Daniel H. wrote:

You can use
find(:first, :select => “DISTINCT *”)

Bojan


Bojan M.
Informatika Mihelac, Bojan M. s.p. | www.informatikamihelac.com
-> tools, scripts, tricks from our code lab: http://source.mihelac.org

On Jun 20, 2006, at 11:53 AM, Daniel H. wrote:

I’m looking through the api for something like find(:all, :distinct
=> true)
so that multiple instances of a row won’t be returned - is this
possible?

You may specify the :uniq => true (the spelling of uniq matches
Ruby’s Array#uniq) option for has_many and has_and_belongs_to_many
associations.

jeremy

Great thanks!

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs