Create and render a flash message partial?


I’m trying to create a partial for flash messages and render it to my
views, but I don’t get it to work. My code looks like this:


<% flash.each do |key, value| %>
<%= content_tag(:div, value, :class => “flash #{key} body_copy
box_padding”) %>
<% end %>

And in my views:
<%= render ‘shared/flash’ %>

And I get the the following error:

You have a nil object when you didn’t expect it!
You might have expected an instance of Array.
The error occurred while evaluating nil.each

Any help would be greatly appreciated!

// Anders

pass the flash object i dont know why but you have to

Thanks! That worked.

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs