Limiting results returned by find


#1

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