I use this code to display flash messages in Rails 3.2.1 apps (well, I did):
<% flash.each do |name, msg| %>
<div class="alert alert-<%= name == :notice ? "success" : "error" %>">
<%= msg %>
</div>
<% end %>
But I get nothing. So I put <%= debug flash %> to see what I was getting back after an update and I get this:
--- !ruby/object:ActionDispatch::Flash::FlashHash
used: !ruby/object:Set
hash: {}
closed: false
flashes: {}
now:
How to I do the same thing?
The code I use for displaying flash messages and alerts is:
But if your flash hash is empty, it’s not going to display anything. Are you sure you’re setting your flash hash properly?