<% flash.each do |k, v| %>
  <% next unless %w(success danger warning info).include?(k.to_s) %>

  <div class="alert alert-<%= k %> alert-dismissible fade show" role="alert">
    <%= v %>
    <button type="button" class="close" data-dismiss="alert" aria-label="Close">
      <span aria-hidden="true">&times;</span>
    </button>
  </div>
<% end %>
<% flash.now.as_json.each do |k, v| %>
  <% next unless %w(success danger warning info).include?(k.to_s) %>

  <div class="alert alert-<%= k %> alert-dismissible fade show" role="alert">
    <%= v %>
    <button type="button" class="close" data-dismiss="alert" aria-label="Close">
      <span aria-hidden="true">&times;</span>
    </button>
  </div>
<% end %>