Displaying 1 result from an estimated 1 matches for "create_player".
2006 Jul 18
1
Saving an ActiveRecord object
I get this error when I try to save an object that extends of
ActiveRecord:
NoMethodError in TeamController#add_player
You have a nil object when you didn''t expect it!
The error occured while evaluating nil.keys
....
....
#{RAILS_ROOT}/app/models/player.rb:17:in `create_player''
#{RAILS_ROOT}/app/controllers/team_controller.rb:53:in `add_player''
And my Player model is:
class Player < ActiveRecord::Base
belongs_to :team
# Crea un jugador con los valores por defecto
def Player.create_player(team_id)
player = Player.new
player.relate_to_...