diff --git a/app/models/user.rb b/app/models/user.rb index 6e3ed1da..fb32d232 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -63,7 +63,7 @@ class User < ApplicationRecord # rubocop:disable Metrics/ClassLength validates :email, fake_email: true, typoed_email: true validates :screen_name, presence: true, - format: { with: SCREEN_NAME_REGEX }, + format: { with: SCREEN_NAME_REGEX, message: I18n.t("activerecord.validation.user.screen_name.format") }, length: { minimum: 1, maximum: 16 }, uniqueness: { case_sensitive: false }, screen_name: true diff --git a/config/locales/activerecord.en.yml b/config/locales/activerecord.en.yml index 91605b34..c14e12b4 100644 --- a/config/locales/activerecord.en.yml +++ b/config/locales/activerecord.en.yml @@ -96,6 +96,10 @@ en: primary_color: "The primary/brand colour of the site, used for navigation, links, etc." success_color: "Colour used for messages if something went through successfully." warning_color: "Colour used for warnings if something non-critical has happened." + validation: + user: + screen_name: + format: "contains invalid characters" helpers: submit: user: