This project is archived and is in readonly mode.

#6274 ✓duplicate
Wolfram Arnold

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

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

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?

Comments and changes to this ticket

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile »

<h2 style="font-size: 14px">Tickets have moved to Github</h2>

The new ticket tracker is available at <a href="https://github.com/rails/rails/issues">https://github.com/rails/rails/issues</a>

Pages