biker_miles = User.joins(:trips => :mode).where(:modes => {:name => 'Bike'}).sum(:distance, :group => :user_id) biker_miles.max { |a,b| a[1].to_i <=> b[1].to_i }
I need to pick this apart to really understand what it does, but I know it pulled the data we needed. It seems like this is just the magic that makes RoR so spectacular. It's like the salt on my popcorn...the cream in my coffee. More on this later.
No comments:
Post a Comment