Evan C wrote in post #836439:> Hi everyone. I''d like to query the errors object to work out
exactly
> what kind of error each attribute has. I''m doing this so that I
can
> display a link to a relevant help page on certain types of errors.
>
> At the moment, I''m doing this by determining the type of error
based
> on the error message. However, this is going to get messy when I
> translate my app into multiple languages.
>
> Does anyone know of a way to determine which validation caused a
> specific error?
> thanks
>
> Evan
Hey, did you ever find a solution to this? I''m also in a situation
where
I want this, which is that when my controller actions are being used as
an API, I''d like to return the error "types" (e.g. :invalid,
:blank)
instead of error strings. But as I was writing this, I just thought of a
possible solution: internationalization! What if I create an api.yml
language file, and then specify whatever I want for the translation. I
could even use integer codes if I wanted. Will that work for you?
--
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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en.