Khalid Zubair
2006-Sep-04 20:44 UTC
Having trouble with update_attributes() after member access
I''m having problems in a controller i am writing. i get this exception: wrong number of arguments (1 for 0) ## this does not work: @voicemail_user = VoicemailUser.find(session[:asterisk][:user_id]) if (@voicemail_user.password == params[:pwd][:current]) @voicemail_user.update_attributes({"password" => params[:pwd][:newpwd2]}) end ## but this works: @voicemail_user = VoicemailUser.find(session[:asterisk][:user_id]) @voicemail_user.update_attributes({"password" => params[:pwd][:newpwd2]}) What am i doing wrong? ## application trace below: c:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.14.4/lib/active_record/callbacks.rb:306:in `callback'' c:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.14.4/lib/active_record/callbacks.rb:306:in `valid?'' c:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.14.4/lib/active_record/validations.rb:735:in `save_without_transactions'' c:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.14.4/lib/active_record/transactions.rb:126:in `save'' c:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.14.4/lib/active_record/connection_adapters/abstract/database_statements.rb:51:in `transaction'' c:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.14.4/lib/active_record/transactions.rb:91:in `transaction'' c:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.14.4/lib/active_record/transactions.rb:118:in `transaction'' c:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.14.4/lib/active_record/transactions.rb:126:in `save'' c:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.14.4/lib/active_record/base.rb:1439:in `update_attributes'' #{RAILS_ROOT}/app/controllers/voicemail_users_controller.rb:135:in `user_pwd_change'' -e:4:in `load'' -e:4 -- 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-/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 -~----------~----~----~----~------~----~------~--~---
Scott Meade
2006-Sep-04 21:49 UTC
Re: Having trouble with update_attributes() after member access
What line is 135:in `user_pwd_change'' ? --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Khalid Zubair
2006-Sep-04 22:03 UTC
Re: Having trouble with update_attributes() after member acc
Scott Meade wrote:> What line is 135:in `user_pwd_change'' ?I''ve got some help on #rubyonrails. i''ll edit the OP with this info. -- 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-/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 -~----------~----~----~----~------~----~------~--~---
Khalid Zubair
2006-Sep-04 22:09 UTC
Re: Having trouble with update_attributes() after member acc
Khalid Zubair wrote:> Scott Meade wrote: >> What line is 135:in `user_pwd_change'' ? > > I''ve got some help on #rubyonrails. i''ll edit the OP with this info.OK, looks like i can''t edit my OP here (heh heh new to this forum). I have a column called callback in my table. callback is a method that is used by ActiveRecord and things go crazy when it is an attribute also. I tried adding these methods as a work around to alias the callback column: def callback_column=(value); attributes["callback"] = value; end def callback_column attributes["callback"] end but it doesn''t fix things like ["callback_column"] etc or when i do a VoicemailUser.content_columns to iterate over the hash. is there a general purpose fix to alias column names when they conflict with rails? -- 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-/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 -~----------~----~----~----~------~----~------~--~---