diff --git a/config/locales/server.en.yml b/config/locales/server.en.yml index 2a4db8fad3a..f4b4c33ca5b 100644 --- a/config/locales/server.en.yml +++ b/config/locales/server.en.yml @@ -36,6 +36,8 @@ en: is_reserved: "is reserved" errors: + messages: + too_long_validation: "is limited to %{max} characters; you entered %{length}." embed: load_from_remote: "There was an error loading that post." diff --git a/lib/validators/stripped_length_validator.rb b/lib/validators/stripped_length_validator.rb index 37628a2a487..f2f60f61fb5 100644 --- a/lib/validators/stripped_length_validator.rb +++ b/lib/validators/stripped_length_validator.rb @@ -5,7 +5,7 @@ class Validators::StrippedLengthValidator < ActiveModel::EachValidator stripped_length = value.strip.length record.errors.add attribute, (I18n.t('errors.messages.too_short', count: range.begin)) unless stripped_length >= range.begin - record.errors.add attribute, (I18n.t('errors.messages.too_long', count: range.end)) unless + record.errors.add attribute, (I18n.t('errors.messages.too_long_validation', max: range.end, length: stripped_length)) unless stripped_length <= range.end else record.errors.add attribute, (I18n.t('errors.messages.blank'))