我正在使用 Rails 3 应用程序,需要调整密码重新发送视图上的错误消息。如果用户输入电子邮件地址并提交,目前,应用程序将显示以下错误消息:
Email not found
我需要将此错误消息更改为:
We don't have an account with that e-mail address. Maybe you used another address?
我知道您可以在设计 YML 文件中进行调整,但不确定如何执行此操作……有什么建议吗?
工作代码
class PasswordsController < Devise::PasswordsController
def create
user = User.find_by_email(params[:user][:email])
if user.nil?
flash.now[:notice] = "We don't have an account with that e-mail address. Maybe you used another address?"
end
super
end
end