When I create a new game I have this 10.times { @game.rounds.create } for round in @game.rounds 6.times { round.add_actions } end
Here are my specifications. A game has and belongs to many teams There are two teams per game. There are three players on a team. Each game can have any number of actions (which belong to a round), but % 6 will always = 0, because they are added in 6s.
This does not work: for round in @game.rounds 3.times { @game.teams[0].players << round.actions.create } 3.times { @game.teams[1].players << round.actions.create } end I am trying to get it so each action is linked with a player. Also, so each team is linked to all the actions of each player, so I can track how many times a player has done an action. My problem is I cannot get the actions to link to the player and have the team track how many times an action has been committed, per game.