lib/audited/auditor.rb in audited-5.3.1 vs lib/audited/auditor.rb in audited-5.3.2
- old
+ new
@@ -231,27 +231,29 @@
private
def audited_changes(for_touch: false)
all_changes = if for_touch
- previous_changes
- elsif respond_to?(:changes_to_save)
- changes_to_save
- else
- changes
- end
+ previous_changes
+ elsif respond_to?(:changes_to_save)
+ changes_to_save
+ else
+ changes
+ end
filtered_changes = \
if audited_options[:only].present?
all_changes.slice(*self.class.audited_columns)
else
all_changes.except(*self.class.non_audited_columns)
end
if for_touch
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
+ audits.last.audited_changes[k].to_json == v[1].to_json
end
end
filtered_changes = redact_values(filtered_changes)
filtered_changes = filter_encrypted_attrs(filtered_changes)