aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib/active_record
diff options
context:
space:
mode:
Diffstat (limited to 'activerecord/lib/active_record')
-rw-r--r--activerecord/lib/active_record/associations/association_collection.rb3
1 files changed, 3 insertions, 0 deletions
diff --git a/activerecord/lib/active_record/associations/association_collection.rb b/activerecord/lib/active_record/associations/association_collection.rb
index 0ff91fbdf8..0ad58010b2 100644
--- a/activerecord/lib/active_record/associations/association_collection.rb
+++ b/activerecord/lib/active_record/associations/association_collection.rb
@@ -202,6 +202,9 @@ module ActiveRecord
records.each do |record|
@target.delete(record)
+ if respond_to?(:cached_counter_attribute_name) && @owner[cached_counter_attribute_name]
+ @owner.class.decrement_counter(cached_counter_attribute_name, @owner.send(@owner.class.primary_key))
+ end
callback(:after_remove, record)
end
end