Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

emphasize that callbacks are called in destroy_all

Cleaned up rdoc a bit emphasizing that callbacks are called. Also
removed the stress on the fact that records are always removed.

If callbacks return false then records will not be deleted.
  • Loading branch information...
commit 7b24cf0391ed8916bf12781a179b4ac5995e1690 1 parent d790b50
@neerajdotname neerajdotname authored
View
8 activerecord/lib/active_record/associations/collection_association.rb
@@ -237,11 +237,11 @@ def delete(*records)
end
end
- # Destroy +records+ and remove them from this association calling
- # +before_remove+ and +after_remove+ callbacks.
+ # Deletes the +records+ and removes them from this association calling
+ # +before_remove+ , +after_remove+ , +before_destroy+ and +after_destroy+ callbacks.
#
- # Note that this method will _always_ remove records from the database
- # ignoring the +:dependent+ option.
+ # Note that this method removes records from the database ignoring the
+ # +:dependent+ option.
def destroy(*records)
records = find(records) if records.any? { |record| record.kind_of?(Fixnum) || record.kind_of?(String) }
delete_or_destroy(records, :destroy)
View
6 activerecord/lib/active_record/associations/collection_proxy.rb
@@ -422,9 +422,9 @@ def delete_all
@association.delete_all
end
- # Deletes the records of the collection directly from the database.
- # This will _always_ remove the records ignoring the +:dependent+
- # option.
+ # Deletes the records of the collection directly from the database
+ # ignoring the +:dependent+ option. It invokes +before_remove+,
+ # +after_remove+ , +before_destroy+ and +after_destroy+ callbacks.
#
# class Person < ActiveRecord::Base
# has_many :pets
Please sign in to comment.
Something went wrong with that request. Please try again.