我试过以下,但它不工作。它仍然使用默认的Flash消息。如何为Devise创建自定义Flash消息?
class Users::SessionsController < Devise::SessionsController
after_action :custom_welcome, :only => [:create]
def custom_welcome
flash.notice = "Welcome back "+current_user.name+"." if flash.keys.include?(:notice)
end
end
参考:https://github.com/plataformatec/devise#configuring-controllers
https://stackoverflow.com/a/5513172/148844
这不回答这个问题。 –