Module: ActionArgs::ActiveSupport::CallbackParameterizerLegacy
- Included in:
- ActiveSupport::Callbacks::Callback
- Defined in:
- lib/action_args/callbacks.rb
Overview
For Rails 4 & 5.0
Instance Method Summary collapse
-
#make_lambda(filter) ⇒ Object
Extending AS::Callbacks::Callback’s ‘make_lambda` not just to call specified method but to call the method with method parameters taken from `params`.
Instance Method Details
#make_lambda(filter) ⇒ Object
Extending AS::Callbacks::Callback’s ‘make_lambda` not just to call specified method but to call the method with method parameters taken from `params`. This would happen only when
-
the filter was defined in Symbol form
-
the target object is_a ActionController object
33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 |
# File 'lib/action_args/callbacks.rb', line 33 def make_lambda(filter) if Symbol === filter lambda do |target, _, &blk| if ActionController::Base === target target.strengthen_params! filter values = target.extract_method_arguments_from_params filter target.send filter, *values, &blk else target.send filter, &blk end end else super end end |