Rails 4: Flash messages linger for an extra page view
I am using the following code in my layout to display two types of flash
messages:
<% if !flash[:notice].nil? %>
<div class="row">
<div class="flash notice col-xs-12">
<%= flash[:notice] %>
</div>
</div>
<% end %>
<% if !flash[:error].nil? %>
<div class="row">
<div class="flash error col-xs-12">
<%= flash[:error] %>
</div>
</div>
<% end %>
<%= debug(flash[:notice]) %>
<%= debug(flash[:error]) %>
They both work fine, but whenever one is triggered, it will still appear
for one additional page view. I'm not using any caching gems.
Why is this happening? And how do I fix it?
No comments:
Post a Comment