search for: add_player

Displaying 2 results from an estimated 2 matches for "add_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 &l...
2006 Mar 09
1
Howto save / update using multiple tables?
# Controller def create @person = Person.new(params[:person]) @address = Address.new(params[:address]) ... end If a person has an address, how can I save some data into 2 different tables? Can I do the following? @person.address = @address if @person.save render ... else render_text "Error" end Or do I have to use: if @person.save if @address.save render ... else