2012-06-20 45 views
2

我正在使用Rails 3应用程序,并且需要在密码重发视图上调整错误消息。如果电子邮件地址的用户类型并提交,目前,该应用程序将显示此错误消息:Rails 3 /设计 - 更改密码重置的错误消息

Email not found 

我需要改变这个错误消息是:

We don't have an account with that e-mail address. Maybe you used another address? 

我知道,你可以在Devise 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 

回答

2

你可以尝试使用来检查,如果在datbase存在的电子邮件,如果没有它重定向你的密码重置形式使用闪光灯通知

+0

感谢的before_filter为您的建议!我在上面的工作代码中添加了 – dennismonsewicz