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 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,441 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 %>
                </div>
            <% end %>
</div>

...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! :)