Class: AuditedTimeline::AuditDecorator

Inherits:
Draper::Decorator
  • Object
show all
Defined in:
lib/audited_timeline/audit_decorator.rb

Instance Method Summary collapse

Instance Method Details

#audited_titleObject



20
21
22
23
24
25
# File 'lib/audited_timeline/audit_decorator.rb', line 20

def audited_title
  [
    auditable_type.constantize.model_name.human,
    object_name_by_type_and_value(auditable_type, auditable_id)
  ].join(' ')
end

#human_audited_changesObject



7
8
9
10
11
12
13
14
15
16
17
18
# File 'lib/audited_timeline/audit_decorator.rb', line 7

def human_audited_changes
  human_changes = {}
  audited_changes.each_pair do |field, value|
    value = [value].flatten
    if field.end_with?('_id')
      human_changes[field] = value.map { |v| object_name_by_field_and_value(field, v) }
    else
      human_changes[field] = value.map { |v| human_value(field, v) }
    end
  end
  human_changes
end