问题
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
.
回答1:
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"
来源:https://stackoverflow.com/questions/9006270/where-can-i-change-the-email-has-already-been-taken-error-message