search for: home_stats

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

2008 Dec 13
3
how to do "special queries" ala The Rails Way on "associated" conditions?
...wing in a model class: class Game < ActiveRecord::Base has_many :player_stats has_many :players, :through => :player_stats def visitor_stats stats = [] player_stats.each do |stat| stats << stat if stat.player.team.team_code == self.visiting_team_code end stats end def home_stats stats = [] player_stats.each do |stat| stats << stat if stat.player.team.team_code == self.home_team_code end stats end end I understand that this isn''t the most efficient or elegant way to do things. I gleaned this most recently from the posting at (see his Case 3): h...