I'm designing a basic sports application in RoR and I don't know if my database design is correct. For instance, I have:
class Game < ActiveRecord::Base
has_one :home_team
has_one :away_team
end
class Team < ActiveRecord::Base
has_many :games
end
However, someone told me the better way to do this is:
class Game < ActiveRecord::Base
has_many :teams, :through => :game_teams, :limit => 2
end
class Team < ActiveRecord::Base
has_many :games, :through => :game_teams
end
class Game_Teams < ActiveRecord::Base
belongs_to :game
belongs_to :team
end
Is there a reason I would or wouldn't want either design?