"RuntimeError: Called id for nil" when saving

Eric Goodwin
Fri, 19 Aug 2005 20:45:40 -0000

Hey,
I''m having an error when I try to save anything. Here is the output
from
the console. Anyone know why this would be happeing.

 >> asset = Assetstatus.find(1)
=> #<Assetstatus:0x3bd3bf0 @attributes={"title"=>"Not
Started",
"id"=>"1", "deleted"=>nil}>
 >> asset.deleted = 0
=> 0
 >> asset.save
RuntimeError: Called id for nil, which would mistakenly be 4 -- if you
really wanted the id of nil
, use object_id
        from
c:/Ruby/lib/ruby/gems/1.8/gems/activerecord-1.11.1/lib/usermonitor.rb:23:in
`update''
        from
c:/Ruby/lib/ruby/gems/1.8/gems/activerecord-1.11.1/lib/active_record/base.rb:1139:in
`create_or_update_without_callbacks''
        from
c:/Ruby/lib/ruby/gems/1.8/gems/activerecord-1.11.1/lib/active_record/callbacks.rb:249
:in `create_or_update''
        from
c:/Ruby/lib/ruby/gems/1.8/gems/activerecord-1.11.1/lib/active_record/base.rb:965:in
`
save_without_validation''
        from
c:/Ruby/lib/ruby/gems/1.8/gems/activerecord-1.11.1/lib/active_record/validations.rb:6
50:in `save_without_transactions''
        from
c:/Ruby/lib/ruby/gems/1.8/gems/activerecord-1.11.1/lib/active_record/transactions.rb:
128:in `save''
        from
c:/Ruby/lib/ruby/gems/1.8/gems/activerecord-1.11.1/lib/active_record/transactions.rb:
128:in `transaction''
        from
c:/Ruby/lib/ruby/gems/1.8/gems/activerecord-1.11.1/lib/active_record/transactions.rb:
93:in `transaction''
        from
c:/Ruby/lib/ruby/gems/1.8/gems/activerecord-1.11.1/lib/active_record/transactions.rb:
120:in `transaction''
        from
c:/Ruby/lib/ruby/gems/1.8/gems/activerecord-1.11.1/lib/active_record/transactions.rb:
128:in `save''
        from (irb):13
        from :0

Thanks
Eric