diff --git a/lib/makara.rb b/lib/makara.rb index 2471fc40..dff54dd8 100644 --- a/lib/makara.rb +++ b/lib/makara.rb @@ -1,3 +1,4 @@ +require 'active_support' require 'makara/version' require 'makara/railtie' if defined?(Rails) module Makara @@ -31,3 +32,9 @@ module Strategies end end + +ActiveSupport.on_load(:active_record) do + ActiveRecord::LogSubscriber.log_subscribers.each do |subscriber| + subscriber.extend ::Makara::Logging::Subscriber + end +end diff --git a/lib/makara/railtie.rb b/lib/makara/railtie.rb index 888432dd..0b5c73fa 100644 --- a/lib/makara/railtie.rb +++ b/lib/makara/railtie.rb @@ -5,11 +5,5 @@ class Railtie < ::Rails::Railtie app.middleware.use Makara::Middleware end - initializer "makara.initialize_logger" do |app| - ActiveRecord::LogSubscriber.log_subscribers.each do |subscriber| - subscriber.extend ::Makara::Logging::Subscriber - end - end - end end