Class: Kaui::AuditLog

Inherits:
Object
  • Object
show all
Defined in:
app/models/kaui/audit_log.rb

Class Method Summary collapse

Class Method Details

.description(log) ⇒ Object


3
4
5
6
7
8
9
10
11
12
13
14
15
16
# File 'app/models/kaui/audit_log.rb', line 3

def self.description(log)
  if log.changed_by.present?
    changed_str = "#{log.change_type} by #{log.changed_by.strip}"
    if log.reason_code.blank? && log.comments.blank?
      changed_str
    elsif log.reason_code.blank?
      "#{changed_str}: #{log.comments.strip}"
    elsif log.comments.blank?
      "#{changed_str}: #{log.reason_code.strip}"
    else
      "#{changed_str} (#{log.reason_code.strip} #{log.comments.strip})"
    end
  end
end