Skip to content

Commit

Permalink
docs: added rails extensions to custom policy
Browse files Browse the repository at this point in the history
  • Loading branch information
palkan committed Mar 16, 2022
1 parent 639c2d9 commit cbab6c8
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions docs/custom_policy.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,15 @@ class ActionPolicy::Base
include ActionPolicy::Policy::CachedApply
include ActionPolicy::Policy::Defaults

# Rails-specific scoping extensions
extend ActionPolicy::ScopeMatchers::ActiveRecord
scope_matcher :active_record_relation, ActiveRecord::Relation
extend ActionPolicy::ScopeMatchers::ActionControllerParams
scope_matcher :action_controller_params, ActionController::Parameters

# Active Support notifications
prepend ActionPolicy::Policy::Rails::Instrumentation

# ActionPolicy::Policy::Defaults module adds the following

authorize :user
Expand Down

0 comments on commit cbab6c8

Please sign in to comment.