Method: ActiveRecord::Persistence#update!

Defined in:
lib/active_record/persistence.rb

#update!(attributes) ⇒ Object

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.



575
576
577
578
579
580
581
582
# File 'lib/active_record/persistence.rb', line 575

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