Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

Ruby

ODOT Rails App: application.html.erb prints " {} " where the flash alert is.

This is the code of the application.html.erb

<!DOCTYPE html>
<html>
<head>
  <title>Odot</title>
  <%= stylesheet_link_tag    'application', media: 'all', 'data-turbolinks-track' => true %>
  <%= javascript_include_tag 'application', 'data-turbolinks-track' => true %>
  <%= csrf_meta_tags %>
</head>
<body>

<%= yield %>

    <%= flash.each do |type, message| %>
    <div class="alert flash <%= type %>">
    <%= message %>
    </div>
    <% end %>

</body>
</html>

Any ideas why they appear? and how to get rid of them?

Thanks,

1 Answer

I just answered myself.

This line

<%= flash.each do |type, message| %>

should be

<% flash.each do |type, message| %>

Otherwise it is printed :)