16 May 20:40
Find the last entry by user_id
From: Pål Bergström <rails-mailing-list@...>
Subject: Find the last entry by user_id
Newsgroups: gmane.comp.lang.ruby.rails
Date: 2008-05-16 18:43:18 GMT
Subject: Find the last entry by user_id
Newsgroups: gmane.comp.lang.ruby.rails
Date: 2008-05-16 18:43:18 GMT
How do I find the all records that are the latest from each user, by user_id? I'm trying to get an :average working but I can't solve it. This is my find: Dada.average(:column_with_nr, :conditions => ["created_at > ?", @date.to_s(:db)], :order => 'created_at', :select => 'DISTINCT user_id') -- -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ 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@... To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe@... For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Thanks for the tip.
RSS Feed