简体   繁体   English

更改Rails中的默认错误消息

[英]Changing default error messages in Rails

Our client has decided that they would like all blank AR error messages to be changed from "can't be blank" to "must be completed" throughout the entire app. 我们的客户已决定他们希望在整个应用程序中将所有空白AR错误消息从“不能为空”更改为“必须完成”。

What's the easiest Rails'y way of doing this? 什么是最简单的Rails'y方式?

Use config/locales/en.yml 使用config/locales/en.yml

Specifically, put the following in that file: 具体来说,将以下内容放在该文件中:

en:
  activerecord:
    errors:
      messages:
        blank: "must be completed"

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM