public Method

Base.decrement(attribute)

Initializes the attribute to zero if nil and subtracts one. Only makes sense for number-based attributes. Returns self.

Source Code

# File active_record/base.rb, line 2057
def decrement(attribute)
  self[attribute] ||= 0
  self[attribute] -= 1
  self
end
Comments

Have your say
Please use Textile formatting (click here for a cheat sheet). Use <code/> and <pre/> for code samples.
Click here to login with OpenID to to post comments.