decrement!

decrement!(attribute, by = 1) Instance Public methods 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.

delete

delete() Instance Public methods Deletes the record in the database and freezes this instance to reflect that no changes should be made (since they can't be persisted). Returns the frozen instance. The row is simply removed with an SQL DELETE statement on the record's primary key, and no callbacks are executed. To enforce the object's before_destroy and after_destroy callbacks or any :dependent association options, use #destroy.

destroy

destroy() Instance Public methods Deletes the record in the database and freezes this instance to reflect that no changes should be made (since they can't be persisted). There's a series of callbacks associated with destroy. If the before_destroy callback return false the action is cancelled and destroy returns false. See ActiveRecord::Callbacks for further details.

destroy!

destroy!() Instance Public methods Deletes the record in the database and freezes this instance to reflect that no changes should be made (since they can't be persisted). There's a series of callbacks associated with destroy!. If the before_destroy callback return false the action is cancelled and destroy! raises ActiveRecord::RecordNotDestroyed. See ActiveRecord::Callbacks for further details.

destroyed?

destroyed?() Instance Public methods Returns true if this object has been destroyed, otherwise returns false.

increment

increment(attribute, by = 1) Instance Public methods Initializes attribute to zero if nil and adds the value passed as by (default is 1). The increment is performed directly on the underlying attribute, no setter is invoked. Only makes sense for number-based attributes. Returns self.

increment!

increment!(attribute, by = 1) Instance Public methods Wrapper around increment 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.

new_record?

new_record?() Instance Public methods Returns true if this object hasn't been saved yet â that is, a record for the object doesn't exist in the database yet; otherwise, returns false.

persisted?

persisted?() Instance Public methods Returns true if the record is persisted, i.e. it's not a new record and it was not destroyed, otherwise returns false.

reload

reload(options = nil) Instance Public methods Reloads the record from the database. This method finds record by its primary key (which could be assigned manually) and modifies the receiver in-place: account = Account.new # => #<Account id: nil, email: nil> account.id = 1 account.reload # Account Load (1.2ms) SELECT "accounts".* FROM "accounts" WHERE "accounts"."id" = $1 LIMIT 1 [["id", 1]] # => #<Account id: 1, email: 'account@example.com'> Attributes are reloa