From f063cadf88055c76b5ab7f55b3bd2684e5810549 Mon Sep 17 00:00:00 2001 From: Koki Oyatsu Date: Wed, 17 Jan 2024 11:38:55 +0900 Subject: [PATCH 1/2] fix count method signature for active_record60 - refs 95ffb25 - https://github.com/flyerhzm/bullet/commit/95ffb2554952d8d3dd6e608f4f9333f2b8a79f0e --- lib/bullet/active_record60.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/bullet/active_record60.rb b/lib/bullet/active_record60.rb index 419adf09..27f1e5de 100644 --- a/lib/bullet/active_record60.rb +++ b/lib/bullet/active_record60.rb @@ -282,7 +282,7 @@ def count_records ::ActiveRecord::Associations::CollectionProxy.prepend( Module.new do - def count + def count(column_name = nil) if Bullet.start? && !proxy_association.is_a?(::ActiveRecord::Associations::ThroughAssociation) Bullet::Detector::CounterCache.add_counter_cache( proxy_association.owner, @@ -293,7 +293,7 @@ def count proxy_association.reflection.name ) end - super + super(column_name) end end ) From c673436c94332e9e582aa7a0cd823ffd6aec6e31 Mon Sep 17 00:00:00 2001 From: Koki Oyatsu Date: Thu, 18 Jan 2024 10:59:48 +0900 Subject: [PATCH 2/2] fix count method signature for active_record5 - fix also count method signature for active_record5 --- lib/bullet/active_record5.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/bullet/active_record5.rb b/lib/bullet/active_record5.rb index c3336bac..22bfff51 100644 --- a/lib/bullet/active_record5.rb +++ b/lib/bullet/active_record5.rb @@ -273,7 +273,7 @@ def count_records ::ActiveRecord::Associations::CollectionProxy.prepend( Module.new do - def count + def count(column_name = nil) if Bullet.start? && !proxy_association.is_a?(::ActiveRecord::Associations::ThroughAssociation) Bullet::Detector::CounterCache.add_counter_cache( proxy_association.owner, @@ -284,7 +284,7 @@ def count proxy_association.reflection.name ) end - super + super(column_name) end end )