Posted about 6 years ago. Visible to the public. Repeats.

Tailoring Rails error messages for models and attributes

Rails has generic error messages you can define in your locale .yml files. You may override those application-wide error messages using model or attribute scope like this:

Copy
en: activerecord: errors: messages: invalid: is invalid # used for any invalid attribute in the application models: car: invalid: does not work # used for invalid car attributes attributes: driver: invalid: not allowed to drive # used if the car's driver attribute is invalid

Does your version of Ruby on Rails still receive security updates?
Rails LTS provides security patches for old versions of Ruby on Rails (3.2 and 2.3).

Owner of this card:

Avatar
Dominik Schöler
Last edit:
3 months ago
by Dominik Schöler
About this deck:
We are makandra and do test-driven, agile Ruby on Rails software development.
License for source code
Posted by Dominik Schöler to makandra dev
This website uses cookies to improve usability and analyze traffic.
Accept or learn more