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

Refactoring the Flash Code : Alerts/Notices have no text

Per the video "Refactoring the Flash Code"

I'm having an issue where the alerts and notices are showing the colors, but no messages appear.

views/layouts/application.html.erb

<% flash.each do |type, message| %>
  <div class="alert <%= flash_class type %>">
    <button class="close" data-dismiss="alert">&times;</button>
    <% message %>
  </div>
<% end %>

application_helper.rb

def flash_class(type)
  case type
    when :alert
      "alert-error"
    when :notice
      "alert-success"
    else
      ""
  end
end

I think that's all the code that was really changed. Any help is greatly appreciated!

1 Answer

Derp. As I was writing this and making sure the code was indenting properly I noticed I missed an equal sign. Nevermind!

Thanks for post anyway. Just did the same thing!