Method: ActiveRecord::Persistence#decrement!

Defined in:
lib/active_record/persistence.rb

#decrement!(attribute, by = 1) ⇒ Object

Wrapper around decrement that saves the record. This method differs from its non-bang version in that it passes through the attribute setter. Saving is not subjected to validation checks. Returns true if the record could be saved.



316
317
318
# File 'lib/active_record/persistence.rb', line 316

def decrement!(attribute, by = 1)
  decrement(attribute, by).update_attribute(attribute, self[attribute])
end