lib/bullet/detector/counter_cache.rb in bullet-7.2.0 vs lib/bullet/detector/counter_cache.rb in bullet-8.0.0
- old
+ new
@@ -1,7 +1,9 @@
# frozen_string_literal: true
+using Bullet::Ext::Object
+
module Bullet
module Detector
class CounterCache < Base
class << self
def add_counter_cache(object, associations)
@@ -42,14 +44,14 @@
def conditions_met?(object, _associations)
possible_objects.include?(object.bullet_key) && !impossible_objects.include?(object.bullet_key)
end
def possible_objects
- Thread.current[:bullet_counter_possible_objects]
+ Thread.current.thread_variable_get(:bullet_counter_possible_objects)
end
def impossible_objects
- Thread.current[:bullet_counter_impossible_objects]
+ Thread.current.thread_variable_get(:bullet_counter_impossible_objects)
end
private
def create_notification(klazz, associations)