Skip to content

Commit

Permalink
Merge pull request #788 from a-nickol/main
Browse files Browse the repository at this point in the history
Prevent usage of `only:` filter for limiting `after_action` filter
  • Loading branch information
Burgestrand authored May 13, 2024
2 parents 0ab259e + d65edca commit f55c442
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -360,8 +360,15 @@ authorize individual instances.
``` ruby
class ApplicationController < ActionController::Base
include Pundit::Authorization
after_action :verify_authorized, except: :index
after_action :verify_policy_scoped, only: :index
after_action :verify_pundit_authorization

def verify_pundit_authorization
if action_name == "index"
verify_policy_scoped
else
verify_authorized
end
end
end
```

Expand Down

0 comments on commit f55c442

Please sign in to comment.