diff options
author | Rafael Mendonça França <rafaelmfranca@gmail.com> | 2013-03-12 06:01:07 -0700 |
---|---|---|
committer | Rafael Mendonça França <rafaelmfranca@gmail.com> | 2013-03-12 06:01:07 -0700 |
commit | 824a58a75ae0033705603307eae3145ddd580278 (patch) | |
tree | 952c874b858aa3575f39b6d9f41f1a0ef78e0510 /activerecord/lib | |
parent | 8881723d134e3e0942fd45adc6a72a6a6f4383c3 (diff) | |
parent | c3829d31866870e852a64f8a1236f3287d41783b (diff) | |
download | rails-824a58a75ae0033705603307eae3145ddd580278.tar.gz rails-824a58a75ae0033705603307eae3145ddd580278.tar.bz2 rails-824a58a75ae0033705603307eae3145ddd580278.zip |
Merge pull request #9676 from neerajdotname/9567-destroy-should-call-destroy-all
dependent: :destroy should call destroy_all
Diffstat (limited to 'activerecord/lib')
-rw-r--r-- | activerecord/lib/active_record/associations/has_many_association.rb | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/activerecord/lib/active_record/associations/has_many_association.rb b/activerecord/lib/active_record/associations/has_many_association.rb index f59565ae77..b7b4d7e3ae 100644 --- a/activerecord/lib/active_record/associations/has_many_association.rb +++ b/activerecord/lib/active_record/associations/has_many_association.rb @@ -23,9 +23,10 @@ module ActiveRecord if options[:dependent] == :destroy # No point in executing the counter update since we're going to destroy the parent anyway load_target.each(&:mark_for_destruction) + destroy_all + else + delete_all end - - delete_all end end |