instance method
decrement
Ruby on Rails 8.0.4
Since v3.0.20Signature
decrement(attribute, by = 1)
Initializes attribute to zero if nil and subtracts the value passed as by (default is 1). The decrement is performed directly on the underlying attribute, no setter is invoked. Only makes sense for number-based attributes. Returns self.
Parameters
-
attributereq -
byopt = 1
Source
# File activerecord/lib/active_record/persistence.rb, line 655
def decrement(attribute, by = 1)
increment(attribute, -by)
end
Defined in activerecord/lib/active_record/persistence.rb line 655
· View on GitHub
· Improve this page
· Find usages on GitHub
Defined in ActiveRecord::Persistence