Class: Effective::Log
- Inherits:
-
ActiveRecord::Base
- Object
- ActiveRecord::Base
- Effective::Log
- Defined in:
- app/models/effective/log.rb
Instance Method Summary collapse
- #associated_to_s=(value) ⇒ Object
- #child_logs_datatable ⇒ Object
- #details ⇒ Object
- #log(message, status = EffectiveLogging.statuses.first, options = {}) ⇒ Object
- #next_log ⇒ Object
- #prev_log ⇒ Object
- #to_s ⇒ Object
Instance Method Details
#associated_to_s=(value) ⇒ Object
46 47 48 |
# File 'app/models/effective/log.rb', line 46 def associated_to_s=(value) super(value.to_s[0...255].presence) # Take only first 255 characters end |
#child_logs_datatable ⇒ Object
66 67 68 |
# File 'app/models/effective/log.rb', line 66 def child_logs_datatable EffectiveLogsDatatable.new(log_id: id) end |
#details ⇒ Object
54 55 56 |
# File 'app/models/effective/log.rb', line 54 def details self[:details] || {} end |
#log(message, status = EffectiveLogging.statuses.first, options = {}) ⇒ Object
50 51 52 |
# File 'app/models/effective/log.rb', line 50 def log(, status = EffectiveLogging.statuses.first, = {}) EffectiveLogger.log(, status, ( || {}).merge(parent: self)) end |
#next_log ⇒ Object
58 59 60 |
# File 'app/models/effective/log.rb', line 58 def next_log Log.order(id: :asc).where(parent_id: parent_id).where('id > ?', id).first end |
#prev_log ⇒ Object
62 63 64 |
# File 'app/models/effective/log.rb', line 62 def prev_log Log.order(id: :desc).where(parent_id: parent_id).where('id < ?', id).first end |
#to_s ⇒ Object
42 43 44 |
# File 'app/models/effective/log.rb', line 42 def to_s "Log #{id}" end |