Module: FlashHelper

Defined in:
lib/ucb_rails_cli/templates/helpers/flash_helper.rb

Constant Summary collapse

DEFAULT_MAPPING =
{
  :notice => :info,
  :alert => :danger,
  :error => :danger,
}

Instance Method Summary collapse

Instance Method Details

#flash_messagesObject



8
9
10
11
12
13
14
# File 'lib/ucb_rails_cli/templates/helpers/flash_helper.rb', line 8

def flash_messages
  messages =
    flash.map do |type, message|
      (:div, message, class: "alert alert-#{DEFAULT_MAPPING[type.to_sym] || type}", role: "alert")
    end
   safe_join(messages, "\n")
end