1
0
Fork 0
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:
Bruce Li 2015-11-29 23:05:17 +08:00
parent 80f3e7564c
commit 9b68b928fc

View file

@ -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
``` ```