Permalink
Browse files

Merge pull request #14985 from eileencodes/refactor-delete-all-method

refactor and clean up delete_all method
  • Loading branch information...
2 parents b6bab2a + 255de98 commit 7d24aa7dcf58923dca9d0591e14785340e63d158 @guilleiguaran guilleiguaran committed May 6, 2014
Showing with 1 addition and 9 deletions.
  1. +1 −9 activerecord/lib/active_record/associations/collection_association.rb
@@ -194,7 +194,7 @@ def delete_all(dependent = nil)
options[:dependent]
end
- delete_all_with_dependency(dependent).tap do
+ delete_records(:all, dependent).tap do
reset
loaded!
end
@@ -251,14 +251,6 @@ def delete(*records)
delete_or_destroy(records, dependent)
end
- def delete_all_with_dependency(dependent)
- if dependent == :destroy
- delete_or_destroy(load_target, dependent)
- else
- delete_records(:all, dependent)
- end
- end
-
# Deletes the +records+ and removes them from this association calling
# +before_remove+ , +after_remove+ , +before_destroy+ and +after_destroy+ callbacks.
#

0 comments on commit 7d24aa7

Please sign in to comment.