# Update method

**URL:** <https://discuss.rubyonrails.org/t/update-method/17910>\
**Category:** rubyonrails-talk\
**Created:** [September 7, 2007, 9:03pm UTC](https://discuss.rubyonrails.org/t/update-method/17910 "2007-09-07T21:03:23Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Rich](https://avatars.discourse-cdn.com/v4/letter/r/35a633/32.png) [@Rich](https://discuss.rubyonrails.org/u/Rich)\
**Post date:** [September 7, 2007, 9:03pm UTC](https://discuss.rubyonrails.org/t/update-method/17910/1 "2007-09-07T21:03:23Z")

</div>

I have a question on updating records. I have this User model that requires a password in order to save. In the database there is the password hash and salt so I don't save the password. However, when I retrieve a user record and try to update using the save function it would not update. I assume because the password attribute is automatically set to nil when retrieving a record.

Since I cannot use save, I tried the update method. For example if I type on the console

u=User.find(1) u.name="whatever" u.update

This worked but I realized that the update method is not part of the rails API. There are only four update type methods in ActiveRecord::Base, update(:id, attributes), update\_all(updates, conditions=nil), update\_attribute, and update\_attributes.

So my questions are 1) Why does update (without any arguments) work since it is not part of the API documentation? 2) Why does update\_attributes not work in updating my user record but update\_attribute works for one field? 3) Do you know a good way if I want to update my User record if I want to update more than one field? I don't mind using the update method w/ o parameters but I wonder if it is deprecated.

Thanks. -Rich
