Module: Archangel::FlashHelper

Defined in:
app/helpers/archangel/flash_helper.rb

Overview

Flash message helpers

Instance Method Summary collapse

Instance Method Details

#flash_class_for(flash_type) ⇒ String

Converts Rails flash message type to Bootstrap flash message type

Parameters:

  • flash_type (String, Symbol)

    the flash message type

Returns:

  • (String)

    flash message type


14
15
16
17
18
19
20
# File 'app/helpers/archangel/flash_helper.rb', line 14

def flash_class_for(flash_type)
  flash_type = flash_type.to_s.downcase.parameterize

  {
    success: "success", error: "danger", alert: "warning", notice: "info"
  }.fetch(flash_type.to_sym, flash_type)
end