我想为已经收到电子邮件设置自定义错误消息,因此我编辑了config/locales/en.yml
文件。它看起来像这样:
en:
activerecord:
models:
user:
email:
taken: "already being used"
当我提交包含电子邮件的表单时,我收到此错误:
translation data {:email=>{:taken=>"already being used"}} can not be used with :count => 1
我刚刚开始研究i18n所以这可能是一个非常简单的错误,但我找不到答案。
答案 0 :(得分:2)
尝试:
en:
activerecord:
errors:
models:
user:
attributes:
email:
taken: "already being used"
部分
希望这有帮助!