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
感謝的before_filter爲您的建議!我在上面的工作代碼中添加了 – dennismonsewicz