On Wed, Dec 15, 2010 at 10:13 AM, Tom Ha <[email protected]> wrote:
> Hi there,
>
> I have the following validation in a model:
>
> validates_inclusion_of :whatever, :in => [true, false], :message =>
> I18n.t('please_select_whatever')
>
> It seems that the translation does not work in production mode: in all
> languages it's always the english translation that gets diplayed
> (probably because I set english as the default locale in my app...?).
>
> So I am assuming that we can't translate validations in models, because
> models get loaded only once - when the server is booted (and then, the
> default locale would be applied).
>
> Am I right? If yes, how would you solve this problem?
>
> Thanks for your help!
> Tom
>
>
try passing the argument as a lambda function
:message =>lambda { I18n.t('please_select_whatever') }
i havent try it but it makes sense
--
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 [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en.