在哪里可以更改“电子邮件已被占用”错误信息?

发布于 2024-12-28 22:54:40 字数 354 浏览 4 评论 0原文

我需要自定义消息错误:电子邮件已被占用用于电子邮件,我正在使用 Ruby 1.9.2、Rails 3.1.3、Devise 1.5.3,我尝试更改消息:< code>config/locales/devise.en.yml 并在我的 config/locales/en.yml 但它不起作用!

在我的模型/用户中,我有:

validates_uniqueness_of :email, :message => "este mail ya sido utilizado"

它显示该消息,但也显示:电子邮件已被占用

I need customize the message error: Email has already been taken for email, I'm working with Ruby 1.9.2, Rails 3.1.3, Devise 1.5.3, I tried change the message in: config/locales/devise.en.yml and in my
config/locales/en.yml but it doesn't works!

In my models/user I have:

validates_uniqueness_of :email, :message => "este mail ya sido utilizado"

It shows that message but it also shows: Email has already been taken.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

枯叶蝶 2025-01-04 22:54:40

我从未使用过 Devise,但我认为“taken”消息是 ActiveRecord 错误消息(并非特定于 Devise gem)。如果您计划使用非英语区域设置,我建议您更改默认区域设置,而不是向 EN 区域设置添加非英语内容。

sp:
  activerecord:
    errors:
      messages:
        taken: "este %{model} ya sido utilizado"

I never used Devise, but I think the "taken" message is an ActiveRecord error message (not specific to the Devise gem). If you plan on using a non-english locale I would advice you to change the default locale instead of adding non-english content to the EN one.

sp:
  activerecord:
    errors:
      messages:
        taken: "este %{model} ya sido utilizado"
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文