I'm using the following code to display the contents of the flash object in Rails:
<%= flash.each do |k, v| %>
<div class="flash <%= k %>"><%= v %></div>
<% end %>
Instead of showing just the message (or lack there of) it gives me the contents of the flash hash:
{:error=>"Invalid email/password combination."}
or just this if开发者_JAVA百科 there is no flash object created
{}
Is there something wrong in my Rails code, or perhaps something wrong in my Apache setup (it doesn't appear when I push to Heroku)?
Try this (with <%
instead of <%=
for the each loop):
<% flash.each do |k, v| %>
<div class="flash <%= k %>"><%= v %></div>
<% end %>
精彩评论