instance method
delete
Ruby on Rails 2.2.3
Since v2.2.3 Last seen in v2.3.18Available in: v2.2.3 v2.3.18
Signature
delete()
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.
Source
# File activerecord/lib/active_record/base.rb, line 2413
def delete
self.class.delete(id) unless new_record?
freeze
end
Defined in activerecord/lib/active_record/base.rb line 2413
· View on GitHub
· Improve this page
· Find usages on GitHub
Defined in ActiveRecord::Base