update_attribute weirdness in edge

If I am changing a boolean value, no matter what approach I take, I get the same results:

lets say table "users" has an "enabled" field that is boolean:

user = User.find(1) user.enabled.toggle NoMethodError: undefined method `toggle' for false:FalseClass

user = User.find(1) toggle(user.enabled) NoMethodError: undefined method `toggle' for #<Object:0x389a0>

user = User.find(1) user.enabled = true user.save ArgumentError: wrong number of arguments (2 for 1)

user = User.find(1) user.update_attribute(:enabled, true) ArgumentError: wrong number of arguments (2 for 1)

hmm, that's weird, I thought update_attribute took two arguments, well, maybe I should try 1 argument anyhow...

user = User.find(1) user.update_attribute(:enabled => true) ArgumentError: wrong number of arguments (1 for 2)

!!! Smacks head !!!!

Anyone else experiencing similar behavior?

Nope, never seen that. Have you done anything interesting (ie overriding bits of activerecord), either via a plugin or directly in the User model ? I'm guessing the stack trace for the ArgumentErrors that get thrown might be interesting.

Fred

Thank you! I hadn't thought of the plugins messing things up, so I started doing some testing. I checked-out a copy on my fedora VPS (my main dev box is a mac) and the same thing was happening, with a fresh freeze of the rails trunk too. So I started deleting the plugins one by one, and it turned out that it was betternestedset.

Thanks for the help though, if you had not mentioned the plugins, I would have spent even more time on this already huge time waster! I'm going to try and figure out what is happening in betternestedset though.

@foo.update_attributes => http://api.rubyonrails.org/classes/ActiveRecord/Base.html#M001056

@foo.toggle => http://api.rubyonrails.org/classes/ActiveRecord/Base.html#M001063

hope that helps.