From 292c75aa319c877406356a1cb4fb41f4ab597cfd Mon Sep 17 00:00:00 2001 From: Eugen Rochko Date: Mon, 7 Mar 2022 11:21:27 +0100 Subject: [PATCH] Fix nil error when submitting report without `rule_ids` (#17713) --- app/models/report.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/models/report.rb b/app/models/report.rb index 3dd8a6fdd4c..8ba2dd8fd2b 100644 --- a/app/models/report.rb +++ b/app/models/report.rb @@ -129,6 +129,6 @@ class Report < ApplicationRecord def validate_rule_ids return unless violation? - errors.add(:rule_ids, I18n.t('reports.errors.invalid_rules')) unless rules.size == rule_ids.size + errors.add(:rule_ids, I18n.t('reports.errors.invalid_rules')) unless rules.size == rule_ids&.size end end