开发者

flash[:notice] & flash[:error] + refresh button = disappearing

My view with flashes

<% unless flash[:notice].blank? %>
<div id="notification_notice"><%= flash[:notice] %></div>
<% end %>

<% unless flash[:error].blank? %>
<div id="notification_error"><%= flash[:error] %></div>
<% end %>

Question: If error or success it shows very nice. But when I;m do refresh my error or notices开发者_运维知识库 are dispersing. Why? How to edit this bug? Or everything is nice in rails?


This is the expected behavior of rails, the flash messages will be cleared after one request.


The flash will be emptied after the next request. To keep it, you can do this in your controller:

flash.keep(:notice)

See the Documentation on FlashHash

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜