Module: ArtifactLogger::ActiveRecord::ClassMethods

Defined in:
lib/artifact_logger/active_record.rb

Instance Method Summary collapse

Instance Method Details

#enable_artifact_logger(options = {}) ⇒ Object



6
7
8
9
10
11
12
13
14
15
16
17
# File 'lib/artifact_logger/active_record.rb', line 6

def enable_artifact_logger options={}
  #Configure the has_many
  has_many :log, :as => :artifact, :class_name => '::Log::Message', :dependent => :destroy, :autosave => true
  #Store the old logging method
  alias_method :_log, :log
  remove_method :log

  include ArtifactLogger::ModelExtensions

  #Store the levels which are valid
  @_valid_levels = options[:levels]
end