lib/bullet.rb in bullet-4.5.0 vs lib/bullet.rb in bullet-4.6.0

- old
+ new

@@ -5,17 +5,12 @@ require 'bullet/dependency' module Bullet extend Dependency - if active_record? - autoload :ActiveRecord, "bullet/#{active_record_version}" - autoload :ActionController, 'bullet/action_controller2' if active_record2? - end - if mongoid? - autoload :Mongoid, "bullet/#{mongoid_version}" - end + autoload :ActiveRecord, "bullet/#{active_record_version}" if active_record? + autoload :Mongoid, "bullet/#{mongoid_version}" if mongoid? autoload :Rack, 'bullet/rack' autoload :BulletLogger, 'bullet/logger' autoload :Notification, 'bullet/notification' autoload :Detector, 'bullet/detector' autoload :Registry, 'bullet/registry' @@ -41,17 +36,12 @@ def enable=(enable) @enable = @n_plus_one_query_enable = @unused_eager_loading_enable = @counter_cache_enable = enable if enable? reset_whitelist - if mongoid? - Bullet::Mongoid.enable - end - if active_record? - Bullet::ActiveRecord.enable - Bullet::ActionController.enable if active_record2? - end + Bullet::Mongoid.enable if mongoid? + Bullet::ActiveRecord.enable if active_record? end end def enable? !!@enable @@ -82,10 +72,10 @@ @whitelist = {:n_plus_one_query => {}, :unused_eager_loading => {}, :counter_cache => {}} end def bullet_logger=(active) if active - bullet_log_file = File.open("#{rails2? ? RAILS_ROOT : Rails.root.to_s}/log/bullet.log", 'a+') + bullet_log_file = File.open("#{rails? ? Rails.root.to_s : Dir.pwd}/log/bullet.log", 'a+') bullet_log_file.sync = true UniformNotifier.customized_logger = bullet_log_file end end