module ActionController::PermissionsPolicy::ClassMethods
def permissions_policy(**options, &block)
end
end
policy.camera :self
permissions_policy(only: :index) do |policy|
class PagesController < ApplicationController
only: :index to override the header on the index action only:
Options can be passed similar to +before_action+. For example, pass
end
end
policy.geolocation "https://example.com"
permissions_policy do |policy|
class PagesController < ApplicationController
header:
Overrides parts of the globally configured +Feature-Policy+
def permissions_policy(**options, &block) before_action(options) do if block_given? policy = request.permissions_policy.clone yield policy request.permissions_policy = policy end end end