aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGuillermo Iguaran <guilleiguaran@gmail.com>2014-05-05 19:00:29 -0500
committerGuillermo Iguaran <guilleiguaran@gmail.com>2014-05-05 19:00:29 -0500
commit7d24aa7dcf58923dca9d0591e14785340e63d158 (patch)
tree1d41f2062c5b2eac293f207e3ef13d34d95e10fb
parentb6bab2af144d3f35ae2e1661286f2e35f43f5d3a (diff)
parent255de98a9aace147842004774aa0214972b343a4 (diff)
downloadrails-7d24aa7dcf58923dca9d0591e14785340e63d158.tar.gz
rails-7d24aa7dcf58923dca9d0591e14785340e63d158.tar.bz2
rails-7d24aa7dcf58923dca9d0591e14785340e63d158.zip
Merge pull request #14985 from eileencodes/refactor-delete-all-method
refactor and clean up delete_all method
-rw-r--r--activerecord/lib/active_record/associations/collection_association.rb10
1 files changed, 1 insertions, 9 deletions
diff --git a/activerecord/lib/active_record/associations/collection_association.rb b/activerecord/lib/active_record/associations/collection_association.rb
index 1c84973920..48628230c7 100644
--- a/activerecord/lib/active_record/associations/collection_association.rb
+++ b/activerecord/lib/active_record/associations/collection_association.rb
@@ -194,7 +194,7 @@ module ActiveRecord
options[:dependent]
end
- delete_all_with_dependency(dependent).tap do
+ delete_records(:all, dependent).tap do
reset
loaded!
end
@@ -251,14 +251,6 @@ module ActiveRecord
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.
#