Lot of people might have a confusing between the functionality of update_attribute and update_attributes. The purpose of these functions can be understood from their name itself. the first one update_attribute would update a single attribute of the model

Its used as

1
2
@users = User.find(1)
@users.update_attribute(:attribute_name,"attribute_value")

and the later update_attributes updates a whole set of values in the model

1
2
@users = User.find(1)
@users.update_attributes(attribute_1:"attribute_1_value", attribute_2:"attribute_2_value")

Now the important differentiator of these two functions is that the first function update_attribute updates an attribute without running any of the validations mentioned..

So keep that in mind when you are using the update_attribute function, else at times you will find values you didn’t expect to be entered into the database found in them.