Module: ActionController::FeaturePolicy::ClassMethods

Defined in:
actionpack/lib/action_controller/metal/feature_policy.rb

Instance Method Summary collapse

Instance Method Details

#feature_policy(**options, &block) ⇒ Object



35
36
37
38
39
40
41
42
43
# File 'actionpack/lib/action_controller/metal/feature_policy.rb', line 35

def feature_policy(**options, &block)
  before_action(options) do
    if block_given?
      policy = request.feature_policy.clone
      yield policy
      request.feature_policy = policy
    end
  end
end