instance method
update!
Ruby on Rails 7.0.10
Since v4.0.13Signature
update!(attributes)
Updates its receiver just like #update but calls #save! instead of save, so an exception is raised if the record is invalid and saving will fail.
Parameters
-
attributesreq
Source
# File activerecord/lib/active_record/persistence.rb, line 777
def update!(attributes)
# The following transaction covers any possible database side-effects of the
# attributes assignment. For example, setting the IDs of a child collection.
with_transaction_returning_status do
assign_attributes(attributes)
save!
end
end
Defined in activerecord/lib/active_record/persistence.rb line 777
· View on GitHub
· Improve this page
· Find usages on GitHub
Defined in ActiveRecord::Persistence