Skip to main content
100%

Gist 42a9b74b6d7a83fb0f3d

✓ Published0🌍 Public
Aafbroman
Last edited Aug 13, 2012
Created on May 13, 2015

This example demonstrates a Rails view helper and partial that convert flash message types into Bootstrap alert CSS classes. The `bootstrap_class_for` method in `application_helper.rb` maps symbols like `:success`, `:error`, and `:notice` to corresponding `alert-success`, `alert-error`, and `alert-info` classes. The `_flash_messages.html.erb` partial iterates over the flash hash and renders each message inside a styled div, using the helper’s output. The `application.html.erb` layout includes this partial by passing the current flash object, enabling consistent alert rendering across pages.

AI-generated description

Similar vizzes