diff options
author | eileencodes <eileencodes@gmail.com> | 2014-04-23 22:33:24 -0400 |
---|---|---|
committer | eileencodes <eileencodes@gmail.com> | 2014-04-28 14:08:56 -0400 |
commit | 7ad476be6f5b843cded4d1d84d2d22f3f4b43dfc (patch) | |
tree | 85a29f8ad0f51d548391b2a1840373c8d0de99e6 | |
parent | 0d4bf17745eb0589431d8ec35eff1dc4eeacf899 (diff) | |
download | rails-7ad476be6f5b843cded4d1d84d2d22f3f4b43dfc.tar.gz rails-7ad476be6f5b843cded4d1d84d2d22f3f4b43dfc.tar.bz2 rails-7ad476be6f5b843cded4d1d84d2d22f3f4b43dfc.zip |
remove unnecessary code from delete method
Now that we have a new method delete_all_with_dependency this
coupled conditional is no longer needed.
-rw-r--r-- | activerecord/lib/active_record/associations/collection_association.rb | 12 |
1 files 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) |