Module: RenderFlashNow::RenderFlash

Defined in:
lib/render_flash_now/render_flash.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.included(base) ⇒ Object



3
4
5
6
7
# File 'lib/render_flash_now/render_flash.rb', line 3

def self.included(base)
  base.class_eval do
    alias_method_chain :render, :flash
  end
end

Instance Method Details

#render_with_flash(*args) ⇒ Object



9
10
11
12
13
14
15
16
17
18
19
# File 'lib/render_flash_now/render_flash.rb', line 9

def render_with_flash(*args)
  if options = args[1]
    self.class._flash_types.each do |flash_type|
      if type = options.delete(flash_type)
        flash.now[flash_type] = type
      end
    end
  end

  render_without_flash(*args)
end