ActiveRecord has two association
问题 What is the best way to achieve a has two association with activerecord? I have a Team and Game models. Each Team will have_many games @team.games . A Game will have two teams @game.hosting_team and @game.opposing_team . I started out with two belongs_to/has_one associations but then @team.games would only return their home games. The other option I can think of is using a HABTM and use a validator to ensure there are only records. The only thing missing is keeping track of the home team. It