Sha256: 10271dbb8502bfc62c75e0193128afe38456b6bfaae50adc60eee921ede77e4a

Contents?: true

Size: 828 Bytes

Versions: 34

Compression:

Stored size: 828 Bytes

Contents

require "timber/integrator"

module Timber
  module Integrations
    module ActiveRecord
      # Reponsible for uninstalling the default `ActiveRecord::LogSubscriber` and replacing it
      # with the `TimberLogSubscriber`.
      #
      # @private
      class LogSubscriber < Integrator
        def initialize
          require "timber/integrations/active_record/log_subscriber/timber_log_subscriber"
        rescue LoadError => e
          raise RequirementNotMetError.new(e.message)
        end

        def integrate!
          return true if Util::ActiveSupportLogSubscriber.subscribed?(:active_record, TimberLogSubscriber)

          Util::ActiveSupportLogSubscriber.unsubscribe!(:active_record, ::ActiveRecord::LogSubscriber)
          TimberLogSubscriber.attach_to(:active_record)
        end
      end
    end
  end
end

Version data entries

34 entries across 34 versions & 1 rubygems

Version Path
timber-2.6.2 lib/timber/integrations/active_record/log_subscriber.rb
timber-2.6.1 lib/timber/integrations/active_record/log_subscriber.rb
timber-2.6.0 lib/timber/integrations/active_record/log_subscriber.rb
timber-2.6.0.pre.beta2 lib/timber/integrations/active_record/log_subscriber.rb
timber-2.6.0.pre.beta1 lib/timber/integrations/active_record/log_subscriber.rb
timber-2.5.1 lib/timber/integrations/active_record/log_subscriber.rb
timber-2.5.0 lib/timber/integrations/active_record/log_subscriber.rb
timber-2.4.0 lib/timber/integrations/active_record/log_subscriber.rb
timber-2.3.4 lib/timber/integrations/active_record/log_subscriber.rb
timber-2.3.3 lib/timber/integrations/active_record/log_subscriber.rb
timber-2.3.2 lib/timber/integrations/active_record/log_subscriber.rb
timber-2.3.1 lib/timber/integrations/active_record/log_subscriber.rb
timber-2.3.0 lib/timber/integrations/active_record/log_subscriber.rb
timber-2.2.3 lib/timber/integrations/active_record/log_subscriber.rb
timber-2.2.2 lib/timber/integrations/active_record/log_subscriber.rb
timber-2.2.1 lib/timber/integrations/active_record/log_subscriber.rb
timber-2.2.0 lib/timber/integrations/active_record/log_subscriber.rb
timber-2.1.10 lib/timber/integrations/active_record/log_subscriber.rb
timber-2.1.9 lib/timber/integrations/active_record/log_subscriber.rb
timber-2.1.8 lib/timber/integrations/active_record/log_subscriber.rb