rails: prevent flash message from showing twice

What's the correct way to set a flash message for the current view but not show it for the next request. In other words usually you set the flash message and redirect and the flash message gets shown on the redirect. I don't want to redirect and so I need to make sure the flash message doesn't get shown twice.


flash.now[:notice] = 'message'

如果你要“渲染”页面,使用flash.now[:notice] ,当你想'重定向'时,使用flash[:notice]

链接地址: http://www.djcxy.com/p/67800.html

上一篇: Flash [:warning]无法与重定向一起使用

下一篇: 导轨:防止闪烁消息显示两次