6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
|
# File 'lib/audited/serialization.rb', line 6
def changes_list
begin
model = auditable_type.constantize
rescue NameError
return
end
columns_hash = model.columns_hash
@reflections = model_reflections(model)
audited_changes.map do |column, value|
next if Audited.serialization_exceptions[auditable_type]&.include?(column)
@column = column
@db_column = columns_hash[column]
next unless @db_column
field = password_changes? ? 'Пароль' : @db_column.
if action == 'update' && value.is_a?(Array)
@initial, @changed = value
else
@changed = value
end
from, to = changes_from_to
next if from.blank? && to.blank?
{
column:,
field:,
from:,
to:
}
end.compact
end
|