From 7ad476be6f5b843cded4d1d84d2d22f3f4b43dfc Mon Sep 17 00:00:00 2001 From: eileencodes Date: Wed, 23 Apr 2014 22:33:24 -0400 Subject: remove unnecessary code from delete method Now that we have a new method delete_all_with_dependency this coupled conditional is no longer needed. --- .../lib/active_record/associations/collection_association.rb | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/activerecord/lib/active_record/associations/collection_association.rb b/activerecord/lib/active_record/associations/collection_association.rb index cb64b7887e..a0eba60101 100644 --- a/activerecord/lib/active_record/associations/collection_association.rb +++ b/activerecord/lib/active_record/associations/collection_association.rb @@ -247,16 +247,8 @@ module ActiveRecord _options = records.extract_options! dependent = _options[:dependent] || options[:dependent] - if records.first == :all - if (loaded? || dependent == :destroy) && dependent != :delete_all - delete_or_destroy(load_target, dependent) - else - delete_records(:all, dependent) - end - else - records = find(records) if records.any? { |record| record.kind_of?(Fixnum) || record.kind_of?(String) } - delete_or_destroy(records, dependent) - end + records = find(records) if records.any? { |record| record.kind_of?(Fixnum) || record.kind_of?(String) } + delete_or_destroy(records, dependent) end def delete_all_with_dependency(dependent) -- cgit v1.2.3