aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib/active_record/counter_cache.rb
diff options
context:
space:
mode:
Diffstat (limited to 'activerecord/lib/active_record/counter_cache.rb')
-rw-r--r--activerecord/lib/active_record/counter_cache.rb6
1 files changed, 3 insertions, 3 deletions
diff --git a/activerecord/lib/active_record/counter_cache.rb b/activerecord/lib/active_record/counter_cache.rb
index 9355a2f7a7..3e637ad2b2 100644
--- a/activerecord/lib/active_record/counter_cache.rb
+++ b/activerecord/lib/active_record/counter_cache.rb
@@ -46,11 +46,11 @@ module ActiveRecord
counter_name = reflection.counter_cache_column
updates = { counter_name.to_sym => object.send(counter_association).count(:all) }
+ updates.merge!(touch_updates(object, touch)) if touch
- unscoped.where(primary_key => object.id).update_all(
- updates.merge(touch_updates(object, touch))
- )
+ unscoped.where(primary_key => object.id).update_all(updates)
end
+
return true
end