From bec7f6647afadba1380c9fe6b0bddb220aa17e84 Mon Sep 17 00:00:00 2001 From: Brett McHargue <ebrett@users.noreply.github.com> Date: Wed, 21 Feb 2024 15:56:19 +0000 Subject: [PATCH] Allow underscore --- app/models/content_page.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/models/content_page.rb b/app/models/content_page.rb index 4ed2715c..bc32350f 100644 --- a/app/models/content_page.rb +++ b/app/models/content_page.rb @@ -9,7 +9,7 @@ class ContentPage < ApplicationRecord scope :published, -> { where("is_published = true") } CHARS_TO_OMIT_FROM_SLUG = ",:()".freeze - ONLY_ALPHA_NUMERIC_COMMA_HYPHEN_SPACE_AND_ROUND_BRACES = /\A[a-zA-Z0-9,:\-() ]+\Z/.freeze + ONLY_ALPHA_NUMERIC_COMMA_HYPHEN_SPACE_AND_ROUND_BRACES = /\A[a-zA-Z0-9,:\-()_ ]+\Z/.freeze TITLE_FORMAT_ERROR_MESSAGE = "Heading should only contain alphabetic, numeric and -#{CHARS_TO_OMIT_FROM_SLUG}".freeze validates :title, format: { with: ONLY_ALPHA_NUMERIC_COMMA_HYPHEN_SPACE_AND_ROUND_BRACES, message: TITLE_FORMAT_ERROR_MESSAGE } validates :title, presence: true, uniqueness: true