Module: FlashRender
- Defined in:
- lib/flash_render.rb,
lib/flash_render/railtie.rb,
lib/flash_render/version.rb
Defined Under Namespace
Classes: Railtie
Constant Summary collapse
- VERSION =
"1.2.0"
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.included(base) ⇒ Object
3 4 5 6 7 8 9 |
# File 'lib/flash_render.rb', line 3 def self.included(base) # Protect from trying to augment modules that appear # as the result of adding other gems. return unless base == ActionController::Base base.alias_method_chain :render, :flash end |
Instance Method Details
#render_with_flash(*args) ⇒ Object
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 |
# File 'lib/flash_render.rb', line 11 def render_with_flash(*args) = args. if alert = .delete(:alert) flash.now[:alert] = alert end if notice = .delete(:notice) flash.now[:notice] = notice end if other_flashes = .delete(:flash) other_flashes.each do |key, value| flash.now[key] = value end end args << render_without_flash(*args) end |