mirror of
https://github.com/varvet/pundit.git
synced 2022-11-09 12:30:11 -05:00
Fix error in code sample, closes #194
This commit is contained in:
parent
d279643496
commit
3bdc40e563
1 changed files with 3 additions and 1 deletions
|
@ -75,11 +75,13 @@ generator, or set up your own base class to inherit from:
|
|||
``` ruby
|
||||
class PostPolicy < ApplicationPolicy
|
||||
def update?
|
||||
user.admin? or not post.published?
|
||||
user.admin? or not record.published?
|
||||
end
|
||||
end
|
||||
```
|
||||
|
||||
In the generated `ApplicationPolicy`, the model object is called `record`.
|
||||
|
||||
Supposing that you have an instance of class `Post`, Pundit now lets you do
|
||||
this in your controller:
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue