On Thu, Aug 12, 2010 at 10:50, Peter <[email protected]> wrote:
> I would like to show custom translated error messages (based on the
> locale in the URL) for my validations. I have to following:
>
> validates :phone, :format => { :with => /^(0{2}|\+)/, :message =>
> I18n.t('validation.need_international_format') }
>
> First, is this the correct way to add custom validation messages or am
> I doing it wrong?
Use :message => :need_international_format and e.g.
en:
activerecord:
errors:
models:
customer:
need_international_format: "must be in the international format"
See http://guides.rubyonrails.org/i18n.html for more info.
--
You received this message because you are subscribed to the Google Groups
"rails-i18n" 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/rails-i18n?hl=en.