How do I override 'Email has already been take

2019-06-27 13:10发布

问题:

I would like to replace this error message with something more instructive, to help the user understand what to do next. Unfortunately I can't seem to find this anywhere in my source; where is it coming from and how can I amend it?

回答1:

Look in config/locales/YOUR_LOCALE.yml and set the following key:

errors:
  messages:
    taken: "has already been taken"

You can find translated files for multiple languages here: https://github.com/svenfuchs/rails-i18n/tree/master/rails/locale