Why can''t I update this row?
>> cs = c.campaigns_segments.first
=> #<CampaignsSegments segment_id: 1, campaign_id: 1, sortable:
nil>>> cs.update_attribute(:sortable, 1)
NoMethodError: undefined method `eq'' for nil:NilClass
from
/Library/Ruby/Gems/1.8/gems/activesupport-3.0.0/lib/active_support/whiny_nil.rb:48:in
`method_missing''
from
/Library/Ruby/Gems/1.8/gems/activerecord-3.0.0/lib/active_record/persistence.rb:256:in
`update''
from
/Library/Ruby/Gems/1.8/gems/activerecord-3.0.0/lib/active_record/locking/optimistic.rb:77:in
`update''
from
/Library/Ruby/Gems/1.8/gems/activerecord-3.0.0/lib/active_record/attribute_methods/dirty.rb:68:in
`update''
from
/Library/Ruby/Gems/1.8/gems/activerecord-3.0.0/lib/active_record/timestamp.rb:60:in
`update''
from
/Library/Ruby/Gems/1.8/gems/activerecord-3.0.0/lib/active_record/callbacks.rb:285:in
`update''
from
/Library/Ruby/Gems/1.8/gems/activesupport-3.0.0/lib/active_support/callbacks.rb:413:in
`_run_update_callbacks''
from
/Library/Ruby/Gems/1.8/gems/activerecord-3.0.0/lib/active_record/callbacks.rb:285:in
`update''
from
/Library/Ruby/Gems/1.8/gems/activerecord-3.0.0/lib/active_record/persistence.rb:247:in
`create_or_update''
from
/Library/Ruby/Gems/1.8/gems/activerecord-3.0.0/lib/active_record/callbacks.rb:277:in
`create_or_update''
from
/Library/Ruby/Gems/1.8/gems/activesupport-3.0.0/lib/active_support/callbacks.rb:423:in
`_run_save_callbacks''
from
/Library/Ruby/Gems/1.8/gems/activerecord-3.0.0/lib/active_record/callbacks.rb:277:in
`create_or_update''
from
/Library/Ruby/Gems/1.8/gems/activerecord-3.0.0/lib/active_record/persistence.rb:39:in
`save''
from
/Library/Ruby/Gems/1.8/gems/activerecord-3.0.0/lib/active_record/validations.rb:43:in
`save''
from
/Library/Ruby/Gems/1.8/gems/activerecord-3.0.0/lib/active_record/attribute_methods/dirty.rb:21:in
`save''
from
/Library/Ruby/Gems/1.8/gems/activerecord-3.0.0/lib/active_record/transactions.rb:237:in
`save''
from
/Library/Ruby/Gems/1.8/gems/activerecord-3.0.0/lib/active_record/transactions.rb:289:in
`with_transaction_returning_status''
from
/Library/Ruby/Gems/1.8/gems/activerecord-3.0.0/lib/active_record/connection_adapters/abstract/database_statements.rb:139:in
`transaction''
from
/Library/Ruby/Gems/1.8/gems/activerecord-3.0.0/lib/active_record/transactions.rb:204:in
`transaction''
from
/Library/Ruby/Gems/1.8/gems/activerecord-3.0.0/lib/active_record/transactions.rb:287:in
`with_transaction_returning_status''
from
/Library/Ruby/Gems/1.8/gems/activerecord-3.0.0/lib/active_record/transactions.rb:237:in
`save''
from
/Library/Ruby/Gems/1.8/gems/activerecord-3.0.0/lib/active_record/transactions.rb:248:in
`rollback_active_record_state!''
from
/Library/Ruby/Gems/1.8/gems/activerecord-3.0.0/lib/active_record/transactions.rb:236:in
`save''
from
/Library/Ruby/Gems/1.8/gems/activerecord-3.0.0/lib/active_record/persistence.rb:117:in
`update_attribute''
--
Posted via http://www.ruby-forum.com/.
--
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Talk" group.
To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en.