lib/bullet.rb in bullet-4.0.0 vs lib/bullet.rb in bullet-4.1.0
- old
+ new
@@ -10,10 +10,18 @@
autoload :ActiveRecord, 'bullet/active_record31'
else
autoload :ActiveRecord, 'bullet/active_record2'
autoload :ActionController, 'bullet/action_controller2'
end
- autoload :Mongoid, 'bullet/mongoid'
+ begin
+ require 'mongoid'
+ if Mongoid::VERSION =~ /\A2\.4/
+ autoload :Mongoid, 'bullet/mongoid24'
+ elsif Mongoid::VERSION =~ /\A3/
+ autoload :Mongoid, 'bullet/mongoid3'
+ end
+ rescue LoadError
+ end
autoload :Rack, 'bullet/rack'
autoload :BulletLogger, 'bullet/logger'
autoload :Notification, 'bullet/notification'
autoload :Detector, 'bullet/detector'
autoload :Registry, 'bullet/registry'