aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib
diff options
context:
space:
mode:
authorChris Kampmeier <chris@kampers.net>2008-12-29 03:05:05 -0500
committerChris Kampmeier <chris@kampers.net>2008-12-29 03:05:05 -0500
commit477d37a0fbc7bfe31f8b83050e36d310ed19fb2a (patch)
treede888280d275a741c357af606bfb83efd4db60eb /activerecord/lib
parent377e72c7008d67ab7c57f6d35d98ee5090cbbb45 (diff)
downloadrails-477d37a0fbc7bfe31f8b83050e36d310ed19fb2a.tar.gz
rails-477d37a0fbc7bfe31f8b83050e36d310ed19fb2a.tar.bz2
rails-477d37a0fbc7bfe31f8b83050e36d310ed19fb2a.zip
Rewrite ActiveRecord::Base#delete docs to remove false information about callbacks, mention return value, and improve clarity
Diffstat (limited to 'activerecord/lib')
-rwxr-xr-xactiverecord/lib/active_record/base.rb16
1 files changed, 9 insertions, 7 deletions
diff --git a/activerecord/lib/active_record/base.rb b/activerecord/lib/active_record/base.rb
index a70f87a843..91bcb62794 100755
--- a/activerecord/lib/active_record/base.rb
+++ b/activerecord/lib/active_record/base.rb
@@ -2502,14 +2502,16 @@ module ActiveRecord #:nodoc:
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