lib/audited/auditor.rb in audited-5.3.2 vs lib/audited/auditor.rb in audited-5.3.3
- old
+ new
@@ -245,15 +245,13 @@
all_changes.slice(*self.class.audited_columns)
else
all_changes.except(*self.class.non_audited_columns)
end
- if for_touch
+ if for_touch && (last_audit = audits.last&.audited_changes)
filtered_changes.reject! do |k, v|
- next unless audits.present?
-
- audits.last.audited_changes[k].to_json == v.to_json ||
- audits.last.audited_changes[k].to_json == v[1].to_json
+ last_audit[k].to_json == v.to_json ||
+ last_audit[k].to_json == v[1].to_json
end
end
filtered_changes = redact_values(filtered_changes)
filtered_changes = filter_encrypted_attrs(filtered_changes)