Lighthouse has a new layout. Prefer the old one? Return to the old layout, and switch back any time from the link at the top of each page.

This project is archived and is in readonly mode.

Ability to specify a custom translation for full_messages gone in Rails 3.x

#6274

In Rails 2.3, I used to be able to specify in the en.yml a specific message to be used as full_message for a specific attribute, like so:

en:
  activerecord:
    errors:
      full_messages:
        credit_card_number:
          authorization_failure: There was a problem authorizing your Credit Card.

This message was invoked, e.g. as follows

errors.add(:credit_card_number, :'authorization_failure')

However, in Rails 3, I get an error message:

Credit card number translation missing: en.activerecord.errors.models.credit_card_payment.attributes.credit_card_number.authorization_failure

I discovered that in Rails 3, the method generate_full_message was removed, which used to check for translations for full_messages.

Despite searching for quite a while I was not able to discover a discussion about this anywhere, or a new way to customize full messages. Overriding format (default: "%{attribute} %{message}") doesn't help here either, because it applies to all messages. I'm looking for a way to bypass the format altogether for specific attributes.

Is this an oversight or a feature or did I miss an entirely new way of doing it?

Reported by Wolfram Arnold · January 10th, 2011 @ 08:18 PM

State: duplicate
Milestone: none
Assigned to: nobody
Importance: Low

Activity

  1. Dmitry Polushkin
  2. Rohit Arondekar
    Rohit Arondekar
    • State changed from new to duplicate
    • Importance changed from to Low

    Marking as duplicate of #3768 Add :full_message option to validations — it's a huge ticket so in case I'm wrong just leave a comment and I'll re-open.

    January 29th, 2011 @ 01:31 PM