Hi,
I am trying to save an ActiveRecord object, and I am getting a strange
error - I checked and all of the required fields of the objects seem to
be present. Here is what I try to do:
self.user.save!
And the error is:
You have a nil object when you didn’t expect it!
You might have expected an instance of Array.
The error occurred while evaluating nil.+
Do you have an idea what it may be? When I put a debug statement right
before, and examined self.user, it showed as if it’s ok:
#<User:0xb70ea1e8 @attributes={“salt”=>“L8Qymoyol2O7rA==”,
“updated_at”=>“2007-12-30 09:58:06”, “details”=>“Valentin Chilaru, New
York NY”, “lock_version”=>nil,
“password_salt”=>“bf99b345ef5e9c70c9afeb9dbdebdaed9b09ca3f41bb714c749e7aac3647f989”,
“id”=>“3”, “exposure”=>“0”, “first_name”=>“Valentin”,
“login”=>“vchilaru”, “created_at”=>“2007-12-30 09:58:06”,
“balance”=>“1000”, “active”=>“1”}>
Thanks
stacktrace:
/usr/lib/ruby/gems/1.8/gems/activerecord-1.15.5/lib/active_record/connection_adapters/abstract/database_statements.rb:59:in
transaction' /usr/lib/ruby/gems/1.8/gems/activerecord-1.15.5/lib/active_record/transactions.rb:95:in
transaction’
/usr/lib/ruby/gems/1.8/gems/activerecord-1.15.5/lib/active_record/transactions.rb:121:in
transaction' /usr/lib/ruby/gems/1.8/gems/activerecord-1.15.5/lib/active_record/transactions.rb:133:in
save!’
/usr/lib/ruby/gems/1.8/gems/activerecord-1.15.5/lib/active_record/associations/association_proxy.rb:123:in
send' /usr/lib/ruby/gems/1.8/gems/activerecord-1.15.5/lib/active_record/associations/association_proxy.rb:123:in
method_mis