Module: ActionArgs::ActiveSupport::CallbackParameterizerLegacy
- 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
62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 |
# File 'lib/action_args/callbacks.rb', line 62 def make_lambda(filter) if Symbol === filter lambda do |target, _, &blk| if ActionController::Base === target target.strengthen_params! filter values, kwargs_values = target.extract_method_arguments_from_params filter values << kwargs_values if kwargs_values.any? target.send filter, *values, &blk else target.send filter, &blk end end else super end end |