Skip to content

Commit

Permalink
Refactor to use update!
Browse files Browse the repository at this point in the history
Replaced update with update! to raise an exception in case of validation
failure, as suggested by the Rails/SaveBang RuboCop rule. This ensures that any
issues with updating the problem_report are explicitly handled by raising an
exception.
  • Loading branch information
AgaDufrat committed Jan 29, 2025
1 parent 7a4e2b4 commit afe3914
Showing 1 changed file with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -74,9 +74,9 @@ def mark_supplied_reports_as_reviewed_and_spam

review_attrs = { reviewed: true, marked_as_spam: }

problem_report.update(review_attrs)
problem_report.update!(review_attrs)
end
rescue ActiveRecord::RecordNotFound
rescue ActiveRecord::RecordNotFound, ActiveRecord::RecordInvalid
false
end

Expand Down

0 comments on commit afe3914

Please sign in to comment.