From f3f8e99045c16d091333cb9d91985ab3bead15ad Mon Sep 17 00:00:00 2001 From: Andreas Nedbal Date: Sun, 15 Oct 2023 06:40:32 +0200 Subject: [PATCH] Use `length` validation instead of `presence` for `MuteRule` --- app/models/mute_rule.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/models/mute_rule.rb b/app/models/mute_rule.rb index 3e2a66af..4ca5e15d 100644 --- a/app/models/mute_rule.rb +++ b/app/models/mute_rule.rb @@ -3,7 +3,7 @@ class MuteRule < ApplicationRecord belongs_to :user - validates :muted_phrase, presence: true + validates :muted_phrase, length: { minimum: 1 } def applies_to?(post) !!(post.content =~ /\b#{Regexp.escape(muted_phrase)}\b/i)