Method: ActiveRecord::Base#delete

Defined in:
lib/active_record/base.rb

#deleteObject

Deletes the record in the database and freezes this instance to reflect that no changes should be made (since they can’t be persisted).

Unlike #destroy, this method doesn’t run any before_delete and after_delete callbacks, nor will it enforce any association :dependent rules.

In addition to deleting this record, any defined before_delete and after_delete callbacks are run, and :dependent rules defined on associations are run.



2413
2414
2415
2416
# File 'lib/active_record/base.rb', line 2413

def delete
  self.class.delete(id) unless new_record?
  freeze
end