Module: FlashMessenger::ControllerHelper

Includes:
Helper
Defined in:
lib/flash-messenger/controller_helper.rb

Instance Method Summary collapse

Methods included from Helper

#flash_messenger, #push_flash

Instance Method Details

#flash_alert(message, options = nil) ⇒ Object



13
14
15
# File 'lib/flash-messenger/controller_helper.rb', line 13

def flash_alert(message, options = nil)
  push_flash(message, options, 'alert')
end

#flash_error(message, options = nil) ⇒ Object



17
18
19
# File 'lib/flash-messenger/controller_helper.rb', line 17

def flash_error(message, options = nil)
  push_flash(message, options, 'error')
end

#flash_message(message, options = nil) ⇒ Object



5
6
7
# File 'lib/flash-messenger/controller_helper.rb', line 5

def flash_message(message, options = nil)
  push_flash(message, options)
end

#flash_model_error(errors, options = nil) ⇒ Object



21
22
23
24
# File 'lib/flash-messenger/controller_helper.rb', line 21

def flash_model_error(errors, options = nil)
  errors = errors.errors if errors.is_a? ActiveRecord::Base
  push_flash(errors.as_json, options, 'modelError')
end

#flash_notice(message, options = nil) ⇒ Object



9
10
11
# File 'lib/flash-messenger/controller_helper.rb', line 9

def flash_notice(message, options = nil)
  push_flash(message, options, 'notice')
end