Skip to content

Commit

Permalink
Allow underscore
Browse files Browse the repository at this point in the history
  • Loading branch information
ebrett committed Feb 21, 2024
1 parent 5983487 commit bec7f66
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion app/models/content_page.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit bec7f66

Please sign in to comment.