Module: ActionPolicy::Rails::Authorizer
- Defined in:
- lib/action_policy/rails/authorizer.rb
Overview
Add instrumentation for ‘authorize!` method
Constant Summary collapse
- EVENT_NAME =
"action_policy.authorize"
Instance Method Summary collapse
Instance Method Details
#authorize(policy, rule) ⇒ Object
9 10 11 12 13 14 15 16 17 |
# File 'lib/action_policy/rails/authorizer.rb', line 9 def (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 |