Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Rewrite ActiveRecord::Base#delete docs to remove false information ab…

…out callbacks, mention return value, and improve clarity
  • Loading branch information...
commit 477d37a0fbc7bfe31f8b83050e36d310ed19fb2a 1 parent 377e72c
@chrisk chrisk authored
Showing with 9 additions and 7 deletions.
  1. +9 −7 activerecord/lib/active_record/base.rb
View
16 activerecord/lib/active_record/base.rb
@@ -2502,14 +2502,16 @@ def save!
create_or_update || raise(RecordNotSaved)
end
- # Deletes the record in the database and freezes this instance to reflect that no changes should
- # be made (since they can't be persisted).
+ # 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 a SQL +DELETE+ statement on the
+ # record's primary key, and no callbacks are executed.
#
- # 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.
+ # To enforce the object's +before_destroy+ and +after_destroy+
+ # callbacks, Observer methods, or any <tt>:dependent</tt> association
+ # options, use <tt>#destroy</tt>.
def delete
self.class.delete(id) unless new_record?
freeze
Please sign in to comment.
Something went wrong with that request. Please try again.