Class: Effective::Log

Inherits:
ActiveRecord::Base
  • Object
show all
Defined in:
app/models/effective/log.rb

Instance Method Summary collapse

Instance Method Details

#associated_to_s=(value) ⇒ Object



41
42
43
# File 'app/models/effective/log.rb', line 41

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

#detailsObject



49
50
51
# File 'app/models/effective/log.rb', line 49

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

#log(message, status = EffectiveLogging.statuses.first, options = {}) ⇒ Object



45
46
47
# File 'app/models/effective/log.rb', line 45

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

#next_logObject



53
54
55
# File 'app/models/effective/log.rb', line 53

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

#prev_logObject



57
58
59
# File 'app/models/effective/log.rb', line 57

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

#to_sObject



37
38
39
# File 'app/models/effective/log.rb', line 37

def to_s
  "Log #{id}"
end