lib/bullet.rb in bullet-6.1.1 vs lib/bullet.rb in bullet-6.1.2

- old
+ new

@@ -36,10 +36,11 @@ :unused_eager_loading_enable, :counter_cache_enable, :stacktrace_includes, :stacktrace_excludes, :skip_html_injection + attr_reader :whitelist attr_accessor :add_footer, :orm_patches_applied available_notifiers = UniformNotifier::AVAILABLE_NOTIFIERS.map { |notifier| "#{notifier}=" } available_notifiers_options = { to: UniformNotifier } delegate(*available_notifiers, **available_notifiers_options) @@ -95,30 +96,30 @@ @stacktrace_excludes || [] end def add_whitelist(options) reset_whitelist - Thread.current[:whitelist][options[:type]][options[:class_name]] ||= [] - Thread.current[:whitelist][options[:type]][options[:class_name]] << options[:association].to_sym + @whitelist[options[:type]][options[:class_name]] ||= [] + @whitelist[options[:type]][options[:class_name]] << options[:association].to_sym end def delete_whitelist(options) reset_whitelist - Thread.current[:whitelist][options[:type]][options[:class_name]] ||= [] - Thread.current[:whitelist][options[:type]][options[:class_name]].delete(options[:association].to_sym) - Thread.current[:whitelist][options[:type]].delete_if { |_key, val| val.empty? } + @whitelist[options[:type]][options[:class_name]] ||= [] + @whitelist[options[:type]][options[:class_name]].delete(options[:association].to_sym) + @whitelist[options[:type]].delete_if { |_key, val| val.empty? } end def get_whitelist_associations(type, class_name) - Array(Thread.current[:whitelist][type][class_name]) + Array(@whitelist[type][class_name]) end def reset_whitelist - Thread.current[:whitelist] ||= { n_plus_one_query: {}, unused_eager_loading: {}, counter_cache: {} } + @whitelist ||= { n_plus_one_query: {}, unused_eager_loading: {}, counter_cache: {} } end def clear_whitelist - Thread.current[:whitelist] = nil + @whitelist = nil end def bullet_logger=(active) if active require 'fileutils'