mirror of
https://github.com/varvet/pundit.git
synced 2022-11-09 12:30:11 -05:00
Update example of :verify_authorized
## Why is this change necessary? - Make the example more newbie friendly. - I saw one of my colleague copied and pasted this code snippet but didn’t notice that the verification for index was totally off. - Official README is widely trusted. It will be great if we can make it more newbie friendly. ## How does it address the issue? - Remove `except` option from `verify_authorized` example. - Add `before_action :verify_authorized` to `verify_policy_scoped` example to complete a scenario.
This commit is contained in:
parent
80f3e7564c
commit
9b68b928fc
1 changed files with 2 additions and 1 deletions
|
@ -193,7 +193,7 @@ forgotten to authorize the action. For example:
|
||||||
|
|
||||||
``` ruby
|
``` ruby
|
||||||
class ApplicationController < ActionController::Base
|
class ApplicationController < ActionController::Base
|
||||||
after_action :verify_authorized, :except => :index
|
after_action :verify_authorized
|
||||||
end
|
end
|
||||||
```
|
```
|
||||||
|
|
||||||
|
@ -205,6 +205,7 @@ authorize individual instances.
|
||||||
|
|
||||||
``` ruby
|
``` ruby
|
||||||
class ApplicationController < ActionController::Base
|
class ApplicationController < ActionController::Base
|
||||||
|
after_action :verify_authorized, :except => :index
|
||||||
after_action :verify_policy_scoped, :only => :index
|
after_action :verify_policy_scoped, :only => :index
|
||||||
end
|
end
|
||||||
```
|
```
|
||||||
|
|
Loading…
Reference in a new issue