Eduardo Yáñez Parareda wrote:
>    def relate_to_team(team_id)
>      @team_id = team_id
>    end

This won't work. Try "self.team_id = team_id" if you want to do this.
team_id is not an instance variable, it's a special field managed by
ActiveRecord. ActiveRecord also provides read_attribute(:my_attr) and
write_attribute(:my_attr, a_value) if you can't call its field accessor
functions or want to overwrite them.

May I also suggest just using:

Player.create :team => the_team

There's no need to write many small functions like this when their
equivalents already exist.