Module: Exposure::Flashing::ClassMethods
- Defined in:
- lib/exposure/behaviors/flashing.rb
Instance Method Summary collapse
-
#flash_for(action_name, options = {}, &block) ⇒ Object
configure flash messages valid action names are :index :show :new :create :edit :update :destroy valid options are :on (optional) :success, :failure, :any default is :any :is (optional if block given) can be a Proc or method name as symbol.
Instance Method Details
#flash_for(action_name, options = {}, &block) ⇒ Object
configure flash messages valid action names are
:index :show :new :create :edit :update :destroy
valid options are
:on (optional)
:success, :failure, :any
default is :any
:is (optional if block given)
can be a Proc or method name as symbol.
18 19 20 21 22 23 24 25 26 27 28 29 30 |
# File 'lib/exposure/behaviors/flashing.rb', line 18 def flash_for(action_name, = {}, &block) [:is] ||= block case [:on] when NilClass, :any self.const_get(:FlashMessages)["#{action_name}.success.html"] = [:is] self.const_get(:FlashMessages)["#{action_name}.failure.html"] = [:is] when :success self.const_get(:FlashMessages)["#{action_name}.success.html"] = [:is] when :failure self.const_get(:FlashMessages)["#{action_name}.failure.html"] = [:is] end end |