Re: [Rails] Re: Search logic

2011-02-21 Thread Jatin kumar
On Mon, Feb 21, 2011 at 2:48 PM, Paul Bergstrom wrote: > I think I'm on the right track. But I get the first post for each user, > not the latest. This is what I use. > > Model.all(:select => "*, max(id)", :group => :user_id) > > How do get the latest? > > In Rails 3 syntax, Post.where(:user_id =>

[Rails] Re: Search logic

2011-02-21 Thread Paul Bergstrom
I think I'm on the right track. But I get the first post for each user, not the latest. This is what I use. Model.all(:select => "*, max(id)", :group => :user_id) How do get the latest? -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the G