Module: Rango::RackFlashMixin
- Defined in:
- lib/rango/mixins/rack-flash.rb
Class Method Summary collapse
-
.included(controller) ⇒ Object
NOTE: it’s important to include this mixin after ImplicitRendering mixin.
Instance Method Summary collapse
Class Method Details
.included(controller) ⇒ Object
NOTE: it’s important to include this mixin after ImplicitRendering mixin
16 17 18 19 20 21 22 23 24 25 26 27 28 29 |
# File 'lib/rango/mixins/rack-flash.rb', line 16 def self.included(controller) if controller.method_defined?(:context) Rango.logger.debug("Extending context by message") controller.class_eval do include Module.new { def context @context ||= super.merge!(message: self.) end } end else Rango.logger.warn("Context method isn't defined") end end |
Instance Method Details
#message ⇒ Object Also known as: flash
31 32 33 34 35 |
# File 'lib/rango/mixins/rack-flash.rb', line 31 def @message ||= begin request.env["x-rack.flash"] end end |