mirror of
https://github.com/varvet/pundit.git
synced 2022-11-09 12:30:11 -05:00
Update README to before_action for Rails 4
Rails 4 uses before_action, instead of before_filter, in controllers. However, before_filter has not been deprecated.
This commit is contained in:
parent
dbf2439800
commit
ca815ab058
1 changed files with 3 additions and 3 deletions
|
@ -129,12 +129,12 @@ conditionally showing links or buttons in the view:
|
||||||
|
|
||||||
Pundit adds a method called `verify_authorized` to your controllers. This
|
Pundit adds a method called `verify_authorized` to your controllers. This
|
||||||
method will raise an exception if `authorize` has not yet been called. You
|
method will raise an exception if `authorize` has not yet been called. You
|
||||||
should run this method in an `after_filter` to ensure that you haven't
|
should run this method in an `after_action` to ensure that you haven't
|
||||||
forgotten to authorize the action. For example:
|
forgotten to authorize the action. For example:
|
||||||
|
|
||||||
``` ruby
|
``` ruby
|
||||||
class ApplicationController < ActionController::Base
|
class ApplicationController < ActionController::Base
|
||||||
after_filter :verify_authorized, :except => :index
|
after_action :verify_authorized, :except => :index
|
||||||
end
|
end
|
||||||
```
|
```
|
||||||
|
|
||||||
|
@ -146,7 +146,7 @@ authorize individual instances.
|
||||||
|
|
||||||
``` ruby
|
``` ruby
|
||||||
class ApplicationController < ActionController::Base
|
class ApplicationController < ActionController::Base
|
||||||
after_filter :verify_policy_scoped, :only => :index
|
after_action :verify_policy_scoped, :only => :index
|
||||||
end
|
end
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue