I have three models of Game> Team> Players, and I want to be able to send the following to add the game along with several teams and players in these teams.
{"game"=>{"name"=>"championship", "teams_attributes"=>[ {"result"=>"won", "players_attributes"=>{"name"=>"Bob"}}, {"result"=>"lost", "players_attributes"=>{"name"=>"Tad"}}]}}
Here are my models:
class Game < ActiveRecord::Base attr_accessible :name, :teams_attributes, :players_attributes
I can get him to add two teams when I add a game, but I can't get her to add a game, add two teams and players to each team. Am I something wrong with my setup? When I try to add, I continue to get the error "cannot convert String to Integer". This is the same error that I received when I had Games> Teams, but it was fixed when I added inverse_of stuff.
Thanks!
source share