search for: high_score

Displaying 1 result from an estimated 1 matches for "high_score".

2008 Nov 10
2
Sort model based on max value of has_many field
...ach 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 find and sort, but can''t figure it out. I did add a helper to the Team model: def high_score matches.maximum(:score) end but still am not sure how to get what I want. I basically want to display a list of the teams, ranked by their highest score. One stickler is, any given team may not have any games at a given time, so team.matches may be null... Thanks! jt -- Posted via http://www...