diff options
Diffstat (limited to 'activerecord/lib/active_record/associations/collection_association.rb')
-rw-r--r-- | activerecord/lib/active_record/associations/collection_association.rb | 14 |
1 files changed, 2 insertions, 12 deletions
diff --git a/activerecord/lib/active_record/associations/collection_association.rb b/activerecord/lib/active_record/associations/collection_association.rb index 4c58094cfd..8ef6b594fd 100644 --- a/activerecord/lib/active_record/associations/collection_association.rb +++ b/activerecord/lib/active_record/associations/collection_association.rb @@ -154,7 +154,7 @@ module ActiveRecord # # See delete for more info. def delete_all - delete(:all).tap do + delete(load_target).tap do reset loaded! end @@ -226,17 +226,7 @@ module ActiveRecord # are actually removed from the database, that depends precisely on # +delete_records+. They are in any case removed from the collection. def delete(*records) - dependent = options[:dependent] - - if records.first == :all - if loaded? || dependent == :destroy - delete_or_destroy(load_target, dependent) - else - delete_records(:all, dependent) - end - else - delete_or_destroy(records, dependent) - end + delete_or_destroy(records, options[:dependent]) end # Destroy +records+ and remove them from this association calling |