Class: Loggun::Modifiers::ActiveRecord
- Defined in:
- lib/loggun/modifiers/active_record.rb,
lib/loggun/modifiers/active_record/loggun_log_subscriber.rb
Defined Under Namespace
Classes: LoggunLogSubscriber
Instance Method Summary collapse
Methods inherited from Base
Instance Method Details
#apply ⇒ Object
4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 |
# File 'lib/loggun/modifiers/active_record.rb', line 4 def apply return unless defined?(::ActiveRecord) && defined?(::ActiveRecord::LogSubscriber) subscriber_class_name = config.modifiers.active_record.log_subscriber_class_name if subscriber_class_name == ::Loggun::Config::DEFAULTS[:active_record][:log_subscriber_class_name] require 'loggun/modifiers/active_record/loggun_log_subscriber' end klass = Object.const_get(subscriber_class_name) return klass.attach_to :active_record if klass.respond_to?(:attach_to) Loggun.warn( "Loggun: passed active_record.log_subscriber_class_name `#{subscriber_class_name}`" \ "must respond to #attached_to method" ) end |