module ActionPolicy::Rails::Authorizer

Add instrumentation for `authorize!` method

Constants

EVENT_NAME

Public Instance Methods

authorize(policy, rule) click to toggle source
Calls superclass method
# File lib/action_policy/rails/authorizer.rb, line 9
def authorize(policy, rule)
  event = {policy: policy.class.name, rule: rule.to_s}
  ActiveSupport::Notifications.instrument(EVENT_NAME, event) do
    res = super
    event[:cached] = policy.result.cached?
    event[:value] = policy.result.value
    res
  end
end