diff options
author | eileencodes <eileencodes@gmail.com> | 2014-05-05 18:05:36 -0400 |
---|---|---|
committer | eileencodes <eileencodes@gmail.com> | 2014-05-05 18:12:41 -0400 |
commit | 255de98a9aace147842004774aa0214972b343a4 (patch) | |
tree | 1d41f2062c5b2eac293f207e3ef13d34d95e10fb | |
parent | b6bab2af144d3f35ae2e1661286f2e35f43f5d3a (diff) | |
download | rails-255de98a9aace147842004774aa0214972b343a4.tar.gz rails-255de98a9aace147842004774aa0214972b343a4.tar.bz2 rails-255de98a9aace147842004774aa0214972b343a4.zip |
refactor and clean up delete_all method
Now that delete_all with destroy or delete_all dependency behave
the same we no longer need this conditional. This means we can remove
the new delete_all_with_dependency method I added and go straight
to delete_records from delete_all, passing :all and the dependent
directly.
-rw-r--r-- | activerecord/lib/active_record/associations/collection_association.rb | 10 |
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. # |