Skip to content

Commit 18b0b72

Browse files
committed
Fix pundit_policy_class_for docs
1 parent 3a706c1 commit 18b0b72

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

guides/authorization/pundit_integration.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -411,11 +411,11 @@ Here's an example of how the custom hooks can be installed:
411411
```ruby
412412
module CustomPolicyLookup
413413
# Lookup policies in the `SystemAdmin::` namespace for system_admin users
414+
# @return [Class]
414415
def pundit_policy_class_for(object, context)
415416
current_user = context[:current_user]
416417
if current_user.system_admin?
417-
policy_class = SystemAdmin.const_get("#{object.class.name}Policy")
418-
policy_class.new(current_user, object)
418+
SystemAdmin.const_get("#{object.class.name}Policy")
419419
else
420420
super
421421
end

0 commit comments

Comments
 (0)