lib/bullet.rb in bullet-2.0.0.rc1 vs lib/bullet.rb in bullet-2.0.0.rc2

- old
+ new

@@ -66,12 +66,11 @@ def bullet_logger=(bullet_logger) Bullet::Presenter::BulletLogger.setup if bullet_logger end def start_request - @notification_collector ||= Bullet::NotificationCollector.new - @notification_collector.reset + notification_collector.reset DETECTORS.each {|bullet| bullet.start_request} end def end_request DETECTORS.each {|bullet| bullet.end_request} @@ -83,13 +82,17 @@ def active_presenters PRESENTERS.select { |presenter| presenter.send :active? } end + def notification_collector + @notification_collector ||= Bullet::NotificationCollector.new + end + def notification? Bullet::Detector::UnusedEagerAssociation.check_unused_preload_associations - @notification_collector.notifications_present? + notification_collector.notifications_present? end def gather_inline_notifications responses = [] for_each_active_presenter_with_notification do |notification| @@ -105,14 +108,14 @@ end private def for_each_active_presenter_with_notification active_presenters.each do |presenter| - @notification_collector.collection.each do |notification| + notification_collector.collection.each do |notification| notification.presenter = presenter yield notification end end end end -end \ No newline at end of file +end