Module: PrettyFlash::ControllerMethods

Defined in:
lib/pretty_flash/pretty_flash.rb

Instance Method Summary collapse

Instance Method Details

#clear_all_flashObject

clear all flash if you need to ensure it is empty. This shouldn’t normally be needed if you are properly using flash and flash.now



5
6
7
8
9
10
# File 'lib/pretty_flash/pretty_flash.rb', line 5

def clear_all_flash
  flash.delete(:success)
  flash.delete(:notice)
  flash.delete(:warning)
  flash.delete(:error)
end

#flash_error(options = {}) ⇒ Object

Add an error flash message



36
37
38
# File 'lib/pretty_flash/pretty_flash.rb', line 36

def flash_error(options={})
  flash_message(options.merge({:msg_sym => :error}))
end

#flash_notice(options = {}) ⇒ Object

Add a notice flash message



26
27
28
# File 'lib/pretty_flash/pretty_flash.rb', line 26

def flash_notice(options={})
  flash_message(options.merge({:msg_sym => :notice}))
end

#flash_success(options = {}) ⇒ Object

Add a success flash message



21
22
23
# File 'lib/pretty_flash/pretty_flash.rb', line 21

def flash_success(options={})
  flash_message(options.merge({:msg_sym => :success}))
end

#flash_warning(options = {}) ⇒ Object

Add a warning flash message



31
32
33
# File 'lib/pretty_flash/pretty_flash.rb', line 31

def flash_warning(options={})
  flash_message(options.merge({:msg_sym => :warning}))
end