开发者

Omit attribute name from validation error message (at start of it)?

开发者 https://www.devze.com 2023-01-03 11:13 出处:网络
I write code in English but I\'m currently doing a site which is fully translated to anoth开发者_Python百科er language (validation error messages included). However, I have a problem because validatio

I write code in English but I'm currently doing a site which is fully translated to anoth开发者_Python百科er language (validation error messages included). However, I have a problem because validation error messages always seem to include the name of the attribute the error is on at the start of the error, e.g.:

Title Prosimo izpolnite naziv fakultete.

I want to get rid of the Title at the start, like so:

Prosimo izpolnite naziv fakultete.

Any help is appreciated. I would rather see if this can be solved without installing any 3rd party plugins. If it's possible to provide translations for attribute names, that would be a cool solution too, but I would still like to know how it can be done both ways (omit or translate).


There is no need to use the error_messages_for helper for errors, you can write your own helper using the record's errors attribute.

You can just iterate over the error objects and display their messages.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号