Module: ShowMessage

Defined in:
lib/show_message.rb,
lib/show_message/engine.rb,
lib/show_message/railtie.rb,
lib/show_message/version.rb,
lib/show_message/view_helpers.rb

Defined Under Namespace

Modules: ViewHelpers Classes: Engine, Railtie

Constant Summary collapse

VERSION =
'1.1.6'.freeze

Instance Method Summary collapse

Instance Method Details

#show_message(type, message, id: true) ⇒ Object



9
10
11
12
13
14
15
16
17
# File 'lib/show_message.rb', line 9

def show_message(type, message, id: true)
  flash_sym =
    if type.to_s.include?('_')
      type
    else
      id ? "#{type}_#{controller_name}" : type.to_s
    end
  flash[flash_sym] = message
end