Ruby on Rails Wednesday, December 15, 2010

> http://guides.rubyonrails.org/i18n.html#translations-for-active-record-models
>
> In particular see the table in section "5.1.2 Error Message
> Interpolation"

Thanks, that helped. The following works:


In the model:

validates_inclusion_of :whatever, :in => [true, false], :message =>
I18n.t('activerecord.errors.models.my_model.attributes.whatever.please_select_whatever')


In config/locales/en.yml:

en:
activerecord:
errors:
models:
my_model:
attributes:
whatever:
please_select_whatever: "Please select whatever."

--
Posted via http://www.ruby-forum.com/.

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

No comments:

Post a Comment