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 White <craig-CnJ8jr4MGtxl57MIdRCFDg@public.gmane.org> --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Like this: Placement.find(:first, :conditions => ["client_id = ? AND discharge_date IS NULL", self], :order => ''admission_date'').facility_id On May 23, 1:09 pm, Craig White <c...-CnJ8jr4MGtxl57MIdRCFDg@public.gmane.org> wrote:> 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 White <c...-CnJ8jr4MGtxl57MIdRCFDg@public.gmane.org>--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
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 ----> > On May 23, 1:09 pm, Craig White <c...-CnJ8jr4MGtxl57MIdRCFDg@public.gmane.org> wrote: > > 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 White <c...-CnJ8jr4MGtxl57MIdRCFDg@public.gmane.org> > > > >-- Craig White <craig-CnJ8jr4MGtxl57MIdRCFDg@public.gmane.org> --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---