I have these models
class Game < ActiveRecord::Base
belongs_to :home_team, :class_name => 'Team'
belongs_to :away_team, :class_name => 'Team'
class Person < ActiveRecord::Base
has_many :teams, :through => :affiliations
class Team < ActiveRecord::Base
has_many :players, :through => :affiliations, :source => :person
class Affiliation < ActiveRecord::Base
I with the associations above, I can get the players for the teams,
the home team and away team players from the games.
I want to be able to go back and get the games that each team and/or
player plays in. The associations work in one direction but not in the
other. How do I work back through the home_team and away_team
connections and get home games, away games and the totals for a given
player or team?