diff options
author | Rafael Mendonça França <rafaelmfranca@gmail.com> | 2013-11-25 17:48:59 -0800 |
---|---|---|
committer | Rafael Mendonça França <rafaelmfranca@gmail.com> | 2013-11-25 17:48:59 -0800 |
commit | e4c0a225ae029af91d26735d8085a09d6d64859e (patch) | |
tree | 3c5d7d29e3342f9187d23ca5d508230014ca2819 /activerecord/lib/active_record/associations/has_many_association.rb | |
parent | 19dd2166103cc1d39d7346714c46f32191958981 (diff) | |
parent | 09f941c507455e5523cd2d990117c1fcf4f0ab9c (diff) | |
download | rails-e4c0a225ae029af91d26735d8085a09d6d64859e.tar.gz rails-e4c0a225ae029af91d26735d8085a09d6d64859e.tar.bz2 rails-e4c0a225ae029af91d26735d8085a09d6d64859e.zip |
Merge pull request #13042 from brianstorti/fix-dependent-destroy-12812
Raise `RecordNotDestroyed` when children can't be replaced
Diffstat (limited to 'activerecord/lib/active_record/associations/has_many_association.rb')
-rw-r--r-- | activerecord/lib/active_record/associations/has_many_association.rb | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/activerecord/lib/active_record/associations/has_many_association.rb b/activerecord/lib/active_record/associations/has_many_association.rb index 0a23109b9b..72e0891702 100644 --- a/activerecord/lib/active_record/associations/has_many_association.rb +++ b/activerecord/lib/active_record/associations/has_many_association.rb @@ -108,7 +108,7 @@ module ActiveRecord # Deletes the records according to the <tt>:dependent</tt> option. def delete_records(records, method) if method == :destroy - records.each { |r| r.destroy } + records.each(&:destroy!) update_counter(-records.length) unless inverse_updates_counter_cache? else if records == :all |