Trey Caliva
Trey Caliva

Reputation: 13

Getting an error on Ruby on Rails Flash

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 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)?

Upvotes: 1

Views: 236

Answers (1)

mbreining
mbreining

Reputation: 7809

Try this (with <% instead of <%= for the each loop):

 <% flash.each do |k, v| %>
   <div class="flash <%= k %>"><%= v %></div>
 <% end %>

Upvotes: 1

Related Questions