# Updating an attribute in db

**URL:** <https://discuss.rubyonrails.org/t/updating-an-attribute-in-db/6973>\
**Category:** rubyonrails-talk\
**Created:** [January 10, 2007, 4:24pm UTC](https://discuss.rubyonrails.org/t/updating-an-attribute-in-db/6973 "2007-01-10T16:24:47Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Sheldon\_Hearn2](https://avatars.discourse-cdn.com/v4/letter/s/edb3f5/32.png) [@Sheldon\_Hearn2](https://discuss.rubyonrails.org/u/Sheldon_Hearn2)\
**Post date:** [January 10, 2007, 4:24pm UTC](https://discuss.rubyonrails.org/t/updating-an-attribute-in-db/6973/1 "2007-01-10T16:24:47Z")

</div>

update\_attribute() calls save(), but remember that save() can return false on failure.

Test the return value of prog.update\_attribute(:salary, 1000). You'll probably find that it's false, which means the save() failed.

Then you can start looking for \_why\_ it failed. However, this is a good lesson. \_Always\_ test for save failure in actions that call it.
