Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

Ruby Build a Simple Ruby on Rails Application Designing URLs Refactoring the Flash Code

Does this code work with the current version of bootstrap?

I am not getting any coloring on the flash messages and when I search for "flash-class" on the Bootstrap site, I get nothing. So, since this video series is obsolete I am not sure if: 1.) I coded it incorrectly and have an error 2.) It's just an outdated video so Bootstrap now has different flash functions or something As per my earlier comments, I hope the Treehouse Gods re-shoot this video series with Rails 4.0 and the current version of Bootstrap.

3 Answers

Maciej Czuchnowski
Maciej Czuchnowski
36,440 Points

I think the version it uses (2.something) is very different from the current version, so try getting your hands on that older version or try to translate stuff into the new one, although the page will not look exactly the same.

Ralph Johnson
Ralph Johnson
10,408 Points

The changes in the code on the Bootstrap website (there are some changes) are listed here:

http://getbootstrap.com/components/#alerts .

I used this form, borrowing from Jim's code and wrapping the extra stuff around it:

<div class="container">
            <% flash.each do |type, message| %>
                <div class="alert<%= flash_class type %> alert-dismissable" role="alert">
                <button type="button" class="close" data-dismiss="alert" aria-label="Close"><span aria-hidden="true">&times;</span></button>
                <%= message %>
            <% end %>

...but I haven't gotten around to testing it yet, sorry. :)

Elkin Arriero
Elkin Arriero
15,160 Points

For this to work on newer bootstrap ver you can go to https://teamtreehouse.com/forum/cant-get-the-flash-messages-loop-to-display-different-alert-classes and see @Kenan Memis' solution... It worked like charm! :)