Skip to content

Commit

Permalink
Clean up the conditional logic
Browse files Browse the repository at this point in the history
  • Loading branch information
jeffdill2 committed Jul 9, 2018
1 parent c9dd57d commit 6599f04
Showing 1 changed file with 4 additions and 9 deletions.
13 changes: 4 additions & 9 deletions lib/audited/auditor.rb
Original file line number Diff line number Diff line change
Expand Up @@ -271,15 +271,10 @@ def write_audit(attrs)
end

def eligible_for_comment_validation?
if !auditing_enabled ||
(audited_options[:on].exclude?(:create) && self.new_record?) ||
(audited_options[:on].exclude?(:update) && self.persisted?) ||
(audited_changes.empty? && self.persisted?)
then
false
else
true
end
auditing_enabled &&
((audited_options[:on].include?(:create) && self.new_record?) ||
(audited_options[:on].include?(:update) && self.persisted?)) &&
!(audited_changes.empty? && self.persisted?)
end

def combine_audits_if_needed
Expand Down

0 comments on commit 6599f04

Please sign in to comment.