设计 - Flash通知 [英] Devise - Flash Notices
本文介绍了设计 - Flash通知的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
使用Rail with Devise,任何时候您登录或注册设计都会从UI角度在页面上吐出一个Flash通知,这似乎不是必需的,通常很明显,对吗?
Using rails with Devise, anytime you sign in or signout devise spits a Flash Notice on the page which doesn't seem necessary from a UI perspective, it's usually pretty obvious, right?
有没有办法在Devise中关闭闪存通知登录和登出?
Is there a way to turn off flash notices in Devise for Sign In and Sign Outs?
谢谢
推荐答案
只需尝试在session_controller.rb中添加此代码即可。
Just try adding this code in your sessions_controller.rb.
class SessionsController < Devise::SessionsController
after_filter :clear_sign_signout_flash, :only => [:create, :destroy]
protected
def clear_sign_signout_flash
if flash.keys.include?(:notice)
flash.delete(:notice)
end
end
end
希望这有助于: - )
Hope this helps :-)
这篇关于设计 - Flash通知的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文