mirror of
https://github.com/varvet/pundit.git
synced 2022-11-09 12:30:11 -05:00
Include Pundit module in controller examples
* In order for the `verify_authorized` and `verify_policy_scoped` methods to be defined in your controllers, you must `include Pundit`. This is stated early in the documentation, but it's not clear in these particular examples that it's needed.
This commit is contained in:
parent
93500247a7
commit
ecb505b114
1 changed files with 2 additions and 0 deletions
|
@ -283,6 +283,7 @@ forgotten to authorize the action. For example:
|
|||
|
||||
``` ruby
|
||||
class ApplicationController < ActionController::Base
|
||||
include Pundit
|
||||
after_action :verify_authorized
|
||||
end
|
||||
```
|
||||
|
@ -295,6 +296,7 @@ authorize individual instances.
|
|||
|
||||
``` ruby
|
||||
class ApplicationController < ActionController::Base
|
||||
include Pundit
|
||||
after_action :verify_authorized, except: :index
|
||||
after_action :verify_policy_scoped, only: :index
|
||||
end
|
||||
|
|
Loading…
Add table
Reference in a new issue