Module: Theme::Bootstrap::ApplicationHelper

Defined in:
app/helpers/theme/bootstrap/application_helper.rb

Instance Method Summary collapse

Instance Method Details

#flash_messagesObject



4
5
6
7
8
9
10
11
12
13
# File 'app/helpers/theme/bootstrap/application_helper.rb', line 4

def flash_messages
  flash_messages = []
  flash.each do |type, message|
    type = 'success' if type == 'notice'
    type = 'error'   if type == 'alert'
    text = "<script>toastr.#{type}('#{message}');</script>"
    flash_messages << text.html_safe if message
  end
  flash_messages.join("\n").html_safe
end