Rails Translation Key Re-Use

I hate re-inventing the wheel. That’s why it’s important to understand what Rails does under the covers during validations where it concerns the messages that are returned as errors. When I perform some custom validations I always try to re-use the already establish error messages. Unfortunately my IDE doesn’t do a great job of auto-completing these for me so I need to refer to the following files for these keys:

  1. Active Model Error Message Keys
  2. Active Record Error Message Keys

Example Usage

some_model.errors.add(:some_field, I18n.t('errors.messages.blank'))