Find :last

I don’t seem to be able to find ‘last’ record but only first record even
though I can ‘order’

Placement.find(:first, :conditions => [“client_id = ? AND discharge_date
IS NULL”, self], :order => ‘admission_date DESC’).facility_id

will still return the ‘first’ record without regard to the :order…how
can I get the ‘last’ record?


Craig W. [email protected]

Like this:

Placement.find(:first, :conditions => [“client_id = ? AND
discharge_date
IS NULL”, self], :order => ‘admission_date’).facility_id

On Wed, 2007-05-23 at 19:15 +0000, dasil003 wrote:

Like this:

Placement.find(:first, :conditions => [“client_id = ? AND
discharge_date
IS NULL”, self], :order => ‘admission_date’).facility_id


duh - I would have sworn that I tried that.

Thanks - it did work


Craig W. [email protected]


Craig W. [email protected]

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