Ruby on rails 3 Rails 3/Desive-更改密码重置的错误消息
我正在使用Rails 3应用程序,需要调整密码重新发送视图上的错误消息。如果用户键入电子邮件地址并提交,当前应用程序将显示以下错误消息:Ruby on rails 3 Rails 3/Desive-更改密码重置的错误消息,ruby-on-rails-3,devise,Ruby On Rails 3,Devise,我正在使用Rails 3应用程序,需要调整密码重新发送视图上的错误消息。如果用户键入电子邮件地址并提交,当前应用程序将显示以下错误消息: Email not found 我需要将此错误消息更改为: We don't have an account with that e-mail address. Maybe you used another address? 我知道您可以在Desive YML文件中对此进行调整,但不确定如何进行调整。。。有什么建议吗 工作代码 class Password
Email not found
我需要将此错误消息更改为:
We don't have an account with that e-mail address. Maybe you used another address?
我知道您可以在Desive 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
类密码控制器
您可以尝试使用before_过滤器,检查电子邮件是否存在于数据库中,如果不存在,它会将您重定向到密码重置表单,并附带一个即时通知谢谢您的建议!我在上面添加了工作代码