module ActiveRecord::Persistence
def increment(attribute, by = 1)
The increment is performed directly on the underlying attribute, no setter is invoked.
Initializes +attribute+ to zero if +nil+ and adds the value passed as +by+ (default is 1).
def increment(attribute, by = 1) self[attribute] ||= 0 self[attribute] += by self end