I'm using from controller status:
flash[:notice] = 'message'
redirect_to(controller: 'item', action: 'list')
I don't know why the notice don't show up.
I tried and checked many things:
flash.keep
flash.keep[:notice] = 'message'
flash[:notice]
works fine withrender
redirect_to(controller: 'item', action: 'list', notice: 'message')
flash.now[:notice] = "Hello world"
flash.now['foo'] = "Hello world"
with<%= flash['foo'] %>
in the view- There is a <%= flash[:notice] %> in the layout
I put the following code to in the layout. flash[:notice] work fine when I the controller method have a view with the same name. The problem happens when I try to reach another controller which don't have a view.
<% if !flash[:notice].blank? %>
<div class="notice">
<%= flash[:notice] %>
</div>
<% end %>
<% if !flash[:alert].blank? %>
<div class="alert">
<%= flash[:alert] %>
</div>
<% end %>
Can anyone help?
Info:
- Ruby (2.0.0)
- Rails (3.2.13)