aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib/active_record
diff options
context:
space:
mode:
authorRafael Mendonça França <rafaelmfranca@gmail.com>2013-11-25 17:48:59 -0800
committerRafael Mendonça França <rafaelmfranca@gmail.com>2013-11-25 17:48:59 -0800
commite4c0a225ae029af91d26735d8085a09d6d64859e (patch)
tree3c5d7d29e3342f9187d23ca5d508230014ca2819 /activerecord/lib/active_record
parent19dd2166103cc1d39d7346714c46f32191958981 (diff)
parent09f941c507455e5523cd2d990117c1fcf4f0ab9c (diff)
downloadrails-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')
-rw-r--r--activerecord/lib/active_record/associations/has_many_association.rb2
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