elikem
9/18/2014 - 12:20 AM

_flash_messages.html.erb

module ApplicationHelper

  def bootstrap_class_for flash_type
    case flash_type
      when 'success'
        'alert-success'
      when 'error'
        'alert-error'
      when 'alert'
        'alert-block'
      when 'notice'
        'alert-info'
      else
        flash_type.to_s
    end
  end
  
end
<%= render partial: "shared/flash_messages", flash: flash %> 
<% flash.each do |type, message| %>
  <div class="alert <%= bootstrap_class_for(type) %> fade in">
    <button class="close" data-dismiss="alert">×</button>
    <%= message %>
  </div>
<% end %>