Last Updated: July 09, 2016
·
678
· yeasayer

Integrate Rails flash alert/notice messages into Bootstrap 3 dismissible alert

<% unless flash.blank? %>
<div class='row'>
  <div class='col-sm-12'>
    <div id='flash'>
      <% flash.each do |key, value| %>
        <div class='flash alert alert-dismissible fade in alert-<%= key == 'notice' ? 'info' : 'danger' %>'>
          <button type='button' class='close' data-dismiss='alert' aria-label='Close'>
            <span aria-hidden='true'>&times;</span>
          </button>
          <%= value %>
        </div>
      <% end %>
    </div>
  </div>
</div>
<% end %>