简体   繁体   中英

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.

What's the easiest Rails'y way of doing this?

Use config/locales/en.yml

Specifically, put the following in that file:

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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