Module: Quorum::Helpers

Included in:
ApplicationController
Defined in:
lib/quorum/helpers.rb

Defined Under Namespace

Modules: Colors

Instance Method Summary collapse

Instance Method Details

#set_flash_message(key, kind, options = {}) ⇒ Object

I18n flash helper. Set flash message based on key.



7
8
9
10
11
12
13
14
# File 'lib/quorum/helpers.rb', line 7

def set_flash_message(key, kind, options = {})
  options[:scope] = "quorum.#{controller_name}"
  options[:scope] << ".errors" if key.to_s == "error"
  options[:scope] << ".notices" if key.to_s == "notice"
  options[:scope] << ".alerts" if key.to_s == "alert"
  message = I18n.t("#{kind}", options)
  flash[key] = message if message.present?
end