From c35e9fb21a0e23424675a25d57ba1821c94a6f86 Mon Sep 17 00:00:00 2001 From: Richard Huang Date: Fri, 17 Nov 2023 19:38:06 +0800 Subject: [PATCH] call association also on through reflection --- lib/bullet/active_record4.rb | 2 +- lib/bullet/active_record41.rb | 2 +- lib/bullet/active_record42.rb | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/bullet/active_record4.rb b/lib/bullet/active_record4.rb index 0818bcb6..0ea921d8 100644 --- a/lib/bullet/active_record4.rb +++ b/lib/bullet/active_record4.rb @@ -108,7 +108,7 @@ def construct_association(record, join, row) if Bullet.start? associations = [node.reflection.name] - if node.reflection.through_reflection? + if node.reflection.chain? associations << node.reflection.through_reflection.name end associations.each do |association| diff --git a/lib/bullet/active_record41.rb b/lib/bullet/active_record41.rb index 0e7e0795..7112b0c3 100644 --- a/lib/bullet/active_record41.rb +++ b/lib/bullet/active_record41.rb @@ -111,7 +111,7 @@ def construct_model(record, node, row, model_cache, id, aliases) if Bullet.start? associations = [node.reflection.name] - if node.reflection.through_reflection? + if node.reflection.chain? associations << node.reflection.through_reflection.name end associations.each do |association| diff --git a/lib/bullet/active_record42.rb b/lib/bullet/active_record42.rb index 75cc1655..8efc2b44 100644 --- a/lib/bullet/active_record42.rb +++ b/lib/bullet/active_record42.rb @@ -153,7 +153,7 @@ def construct_model(record, node, row, model_cache, id, aliases) if Bullet.start? associations = [node.reflection.name] - if node.reflection.through_reflection? + if node.reflection.chain? associations << node.reflection.through_reflection.name end associations.each do |association|