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
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?