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
44 45 46 |
# File 'app/models/effective/log.rb', line 44 def associated_to_s=(value) super(value.to_s[0...255].presence) # Take only first 255 characters end |
#child_logs_datatable ⇒ Object
64 65 66 |
# File 'app/models/effective/log.rb', line 64 def child_logs_datatable EffectiveLogsDatatable.new(log_id: id) end |
#details ⇒ Object
52 53 54 |
# File 'app/models/effective/log.rb', line 52 def details self[:details] || {} end |
#log(message, status = EffectiveLogging.statuses.first, options = {}) ⇒ Object
48 49 50 |
# File 'app/models/effective/log.rb', line 48 def log(, status = EffectiveLogging.statuses.first, = {}) EffectiveLogger.log(, status, ( || {}).merge(parent: self)) end |
#next_log ⇒ Object
56 57 58 |
# File 'app/models/effective/log.rb', line 56 def next_log Log.order(id: :asc).where(parent_id: parent_id).where('id > ?', id).first end |
#prev_log ⇒ Object
60 61 62 |
# File 'app/models/effective/log.rb', line 60 def prev_log Log.order(id: :desc).where(parent_id: parent_id).where('id < ?', id).first end |
#to_s ⇒ Object
40 41 42 |
# File 'app/models/effective/log.rb', line 40 def to_s "Log #{id}" end |