From 42d24737d0998d623d626f6a8cf9b4bf065249a4 Mon Sep 17 00:00:00 2001 From: Vincent Prigent Date: Tue, 21 Jan 2025 16:45:15 +1300 Subject: [PATCH] Disable memoize on string refinement method Its causing all the specs to fail, however I was not able to figure out why it was doing so... --- lib/bullet/detector/n_plus_one_query.rb | 1 + lib/bullet/ext/string.rb | 8 ++------ 2 files changed, 3 insertions(+), 6 deletions(-) diff --git a/lib/bullet/detector/n_plus_one_query.rb b/lib/bullet/detector/n_plus_one_query.rb index 650ea3c9..4b27d4ef 100644 --- a/lib/bullet/detector/n_plus_one_query.rb +++ b/lib/bullet/detector/n_plus_one_query.rb @@ -48,6 +48,7 @@ def add_possible_objects(object_or_objects) end obj.bullet_key end.join(", ") + unless class_names_match_regex || primary_key_values_are_empty Bullet.debug('Detector::NPlusOneQuery#add_possible_objects', "objects: #{keys_joined}") objects.each { |object| possible_objects.add object.bullet_key } diff --git a/lib/bullet/ext/string.rb b/lib/bullet/ext/string.rb index ed4ee285..8319d537 100644 --- a/lib/bullet/ext/string.rb +++ b/lib/bullet/ext/string.rb @@ -4,13 +4,9 @@ module Bullet module Ext module String refine ::String do - attr_reader :bullet_class_name - def bullet_class_name - @bullet_class_name ||= begin - last_colon = self.rindex(':') - last_colon ? self[0...last_colon] : self - end + last_colon = self.rindex(':') + last_colon ? self[0...last_colon].dup : self.dup end end end