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!
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With