Displaying 1 result from an estimated 1 matches for "by_high_score".
2008 Nov 10
2
Sort model based on max value of has_many field
Hi,
I have models such as:
class Team < ActiveRecord::Base
has_many :games
end
class Game< ActiveRecord::Base
belongs_to :team
end
So there are many (well, 0 to 6) games for each team. Team game has a
"score". I would like to get a list of the teams, sorted by the highest
scoring game - sort of a ranking based on highest score. I''ve tried
several cominations of