Hi, having this models:
class Formation < ActiveRecord::Base
has_many :positions, :dependent => :destroy
class TeamFormation < Formation
has_many :players, :through => :positions
class Position < ActiveRecord::Base
I'm trying to modify position's player attribute from a formation:
team.players.each do |player|
self.positions.each do |position|
if !self.players.include?(player) and !position.player
position.player = player <------------ HERE I'M TRYING TO
The first time I create a formation an asign those values all works
fine, but once it's created I
can't modify position's player attr because "can't modify frozen hash"
error is raised.
How could I modify those values?, what am I doing wrong?