Forum: Ruby on Rails limiting results returned by find

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
Simon (Guest)
on 2007-04-18 21:00
(Received via mailing list)
Hi,

I have the following line which returns a collection:
@associated_array = AssociatedAp.find(:all, :include => [:nic], :order
=> "date DESC", :conditions => ['nics.mac = ?', @nic_mac] )

Here @nic_mac is a parameter being passed into the calling function.
This call works perfectly, and returns all of AssociatedAp records
that it should.  However, what I would like to do is limit the
returned set to include only the most recent occurrence of each unique
associated_ap.  The uniqueness should be determined by both the
associated_ap.ssid and associated_ap.mac fields.

Any help on how to accomplish this would be greatly appreciated.

Thanks,

Simon
This topic is locked and can not be replied to.