Module: EffectiveLoggingLog

Extended by:
ActiveSupport::Concern
Defined in:
app/models/concerns/effective_logging_log.rb

Overview

EffectiveLoggingLog

Mark your log model with effective_logging_log to get all the includes

Defined Under Namespace

Modules: Base, ClassMethods

Instance Method Summary collapse

Instance Method Details

#associated_to_s=(value) ⇒ Object



70
71
72
# File 'app/models/concerns/effective_logging_log.rb', line 70

def associated_to_s=(value)
  super(value.to_s[0...255].presence) # Take only first 255 characters
end

#detailsObject



79
80
81
# File 'app/models/concerns/effective_logging_log.rb', line 79

def details
  self[:details] || {}
end

#log(message, status = nil, options = {}) ⇒ Object



74
75
76
77
# File 'app/models/concerns/effective_logging_log.rb', line 74

def log(message, status = nil, options = {})
  status ||= EffectiveLogging.statuses.first
  EffectiveLogger.log(message, status, options)
end

#next_logObject



83
84
85
# File 'app/models/concerns/effective_logging_log.rb', line 83

def next_log
  self.class.order(id: :asc).where('id > ?', id).first
end

#prev_logObject



87
88
89
# File 'app/models/concerns/effective_logging_log.rb', line 87

def prev_log
  self.class.order(id: :desc).where('id < ?', id).first
end

#to_sObject

Instance Methods



66
67
68
# File 'app/models/concerns/effective_logging_log.rb', line 66

def to_s
  "#{model_name.human} ##{id}"
end