Sha256: 35fd320afc838e93b11d50740c0289d1e3cd3bd6499d612dcf1e75bf8761fc98

Contents?: true

Size: 710 Bytes

Versions: 1

Compression:

Stored size: 710 Bytes

Contents

require "timber-rails/active_record/log_subscriber/timber_log_subscriber"

module Timber
  module Integrations
    module ActiveRecord
      # Reponsible for uninstalling the default `ActiveRecord::LogSubscriber` and replacing it
      # with the `TimberLogSubscriber`.
      #
      # @private
      class LogSubscriber < Integrator
        def integrate!
          return true if Timber::Integrations::Rails::ActiveSupportLogSubscriber.subscribed?(:active_record, TimberLogSubscriber)

          Timber::Integrations::Rails::ActiveSupportLogSubscriber.unsubscribe!(:active_record, ::ActiveRecord::LogSubscriber)
          TimberLogSubscriber.attach_to(:active_record)
        end
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
timber-rails-1.0.1 lib/timber-rails/active_record/log_subscriber.rb