Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
使用 merb-auth 切片(除了创建覆盖会话)时,为成功或不成功登录添加 flash 消息的最佳方法是什么?
嘿,火卫二。如果您想在不覆盖创建操作的情况下添加消息,您始终可以使用 after 过滤器。就像是
............
after :set_login_flash, :only => [:create] private def set_login_flash flash[:error] = "You're not logged in" unless logged_in? end
…………
您需要调整它以使用您在应用程序中使用的适当闪存系统,但类似的东西应该适合您。