开发者

Getting an error on Ruby on Rails Flash

开发者 https://www.devze.com 2023-03-06 01:01 出处:网络
I\'m using the following code to display the contents of the flash object in Rails: <%= flash.each do |k, v| %>

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 %>
0

精彩评论

暂无评论...
验证码 换一张
取 消