Module: Flame::Flash

Defined in:
lib/flame/flash.rb,
lib/flame/flash_array.rb

Overview

Module for Flame::Flash extension with helper methods and base class

Defined Under Namespace

Classes: FlashArray

Instance Method Summary collapse

Instance Method Details

#execute(method) ⇒ Object

After hook



7
8
9
10
# File 'lib/flame/flash.rb', line 7

def execute(method)
	super
	record_flashes
end

#halt(*args) ⇒ Object

Capture halt method



28
29
30
31
# File 'lib/flame/flash.rb', line 28

def halt(*args)
	record_flashes
	super
end

#redirect(*args) ⇒ Object

Upgrade redirect method

Examples:

Redirect to show method of Articles controller with error

redirect ArticlesController, :show, id: 2, error: 'Access required'


15
16
17
18
19
20
21
22
23
24
25
# File 'lib/flame/flash.rb', line 15

def redirect(*args)
	if args.last.is_a? Hash
		if args[0].is_a? String
			flashes = args.pop
		else
			args[-1], flashes = extract_flashes(args)
		end
		flash.merge(flashes)
	end
	super
end