I hit a little snag today with Flash Messages and Bootstrap styling. I’m working through the beginner Rails course on Treehouse, and unfortunately the course was created back before Rails 4. At one point in the course, we use a Flash Message Helper, where we clean up  and minimize our code some.

There was just a slight difference in how to define the helper in Rails 4 compared to Rails 3. I went ahead and put the full code in a Github Gist here.

Basically it came down to using strings instead:


module ApplicationHelper

def flash_class(type)

case type

when 'alert' then "alert alert-danger"

when 'notice' then "alert alert-success"






You’ll notice the ‘alert’ and ‘notice’ in strings instead of :alert and :notice like you would have done in Rails 3.

Just wanted to share this!


Hey folks! I ended up going with Michael Hartl’s massively popular (for a reason) Ruby on Rails tutorial course to learn Rails. I highly recommend you do the same.
Check it out here.