Skip to content

Commit

Permalink
Merge pull request #668 from mcyoung/mcy/refactor/touch-enhancement
Browse files Browse the repository at this point in the history
Touch Audit - a little cleanup
  • Loading branch information
danielmorrison authored Apr 24, 2023
2 parents 342734c + 0efe797 commit e38e8a3
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions lib/audited/auditor.rb
Original file line number Diff line number Diff line change
Expand Up @@ -247,12 +247,10 @@ def audited_changes(for_touch: false)
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

Expand Down

0 comments on commit e38e8a3

Please sign in to comment.