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
# File 'app/models/kaui/audit_log.rb', line 3

def self.description(log)
  if log.changed_by.present?
    changed_str = "Performed by #{log.changed_by} on #{ActionController::Base.helpers.format_date(log.change_date)}"
    if log.reason_code.blank? && log.comments.blank?
      changed_str
    elsif log.reason_code.blank?
      "#{changed_str}: #{log.comments}"
    else
      "#{changed_str} (#{log.reason_code} #{log.comments})"
    end
  end
end