lib/bullet.rb in flyerhzm-bullet-1.5.5 vs lib/bullet.rb in flyerhzm-bullet-1.5.6
- old
+ new
@@ -1,9 +1,10 @@
require 'bulletware'
module Bullet
autoload :ActiveRecord, 'bullet/active_record'
+ autoload :ActionController, 'bullet/action_controller'
autoload :Association, 'bullet/association'
autoload :Counter, 'bullet/counter'
autoload :BulletLogger, 'bullet/logger'
autoload :Notification, 'bullet/notification'
@@ -12,11 +13,12 @@
def enable=(enable)
@enable = enable
if enable?
Bullet::ActiveRecord.enable
- ActionController::Dispatcher.middleware.use Bulletware
+ Bullet::ActionController.enable
+ ::ActionController::Dispatcher.middleware.use Bulletware
end
end
def enable?
@enable == true
@@ -48,9 +50,13 @@
BULLETS.each {|bullet| bullet.start_request}
end
def end_request
BULLETS.each {|bullet| bullet.end_request}
+ end
+
+ def clear
+ BULLETS.each {|bullet| bullet.clear}
end
def notification?
BULLETS.any? {|bullet| bullet.notification?}
end