Rules: Fix no action conditions (#447)

* Fix Rules page when no action on rule

* Reject new rules without actions

* Rule with no action translation

* Easy one to keep translations going

* Fix tests

* Learn something new every day

---------

Co-authored-by: Juan José Mata <juanjo.mata@gmail.com>
This commit is contained in:
Dylan Corrales
2025-12-12 10:58:57 -05:00
committed by GitHub
parent 3e5dfc0263
commit 70b050e4a4
11 changed files with 40 additions and 25 deletions

View File

@@ -101,7 +101,7 @@ class Rule < ApplicationRecord
end
def min_actions
return if new_record? && actions.empty?
return if new_record? && !actions.empty?
if actions.reject(&:marked_for_destruction?).empty?
errors.add(:base, "must have at least one action")