Check If ActiveRecord Update Fails
Last updated
Was this helpful?
Last updated
Was this helpful?
There are two ways to update an ActiveRecord
instance (not to mention , , etc.).
You can call and . If the updates would make the record invalid based on the model's validations, then the update will fail.
You can tell if update
failed because it will return false
(instead of true
).
The update!
version will raise an ActiveRecord::ActiveRecordError
exception if the update fails.