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? --~--~---------~--~----~------------~-------~--~----~ 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
On 21 Nov 2007, at 00:50, Dick Dishkuvek wrote:> > If I am changing a boolean value, no matter what approach I take, I > get the same results: > > > user = User.find(1) > user.enabled = true > user.save > ArgumentError: wrong number of arguments (2 for 1)> !!! 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 --~--~---------~--~----~------------~-------~--~----~ 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
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. On Nov 20, 8:09 pm, Frederick Cheung <frederick.che...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> On 21 Nov 2007, at 00:50, Dick Dishkuvek wrote: > > > > > If I am changing a boolean value, no matter what approach I take, I > > get the same results: > > > user = User.find(1) > > user.enabled = true > > user.save > > ArgumentError: wrong number of arguments (2 for 1) > > !!! 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--~--~---------~--~----~------------~-------~--~----~ 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
@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. --~--~---------~--~----~------------~-------~--~----~ 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---