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:invalid?’
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:insave’
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:intransaction’
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:insave’
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:inuser_pwd_change’
-e:4:in `load’
-e:4

What line is 135:in `user_pwd_change’ ?

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.

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?