Change Rails validation message completely
Rails always appends field name to validation messages, and when setting message:
on a validation statement it gets appended to the humanized name of the field.
If you want to change the validation message completely use the locales file:
# config/locales/en.yml
en:
activerecord:
attributes:
user:
email: "E-mail address"
errors:
models:
user:
attributes:
email:
blank: "is required"
This was particularly useful with the ValidatesTimeliness gem which does not support a lambda.
🎉Happy 500 post to TIL 🎉
Tweet