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