Rails: Is there an update or update_attributes that throws exception on failure?

ruby-on-rails, ruby-on-rails-3

Solution

I'm not sure why you think there is no `update_attributes!` because there is. If you were reading the apidock you might have come across an issue such as they talked about here: Why is ActiveRecord::Base#update_attributes deprecated?

Here are the docs detailing the method you want: http://apidock.com/rails/v3.2.13/ActiveRecord/Persistence/update_attributes%21

But, yes, there is an `update_attributes!` that will raise an exception on validation failure. It calls `save!` under the hood.

Problem

Is there an equivalent of `model.update` or `model.update_attributes` that throws an exception on failure? Seems there's not an `update!` or `update_attributes!`

Original source