mirror of
https://github.com/varvet/pundit.git
synced 2022-11-09 12:30:11 -05:00
More accurate depiction of error raised
Show the actual error class and what the message would look like
This commit is contained in:
parent
409f9e0030
commit
72c6c1a606
1 changed files with 3 additions and 1 deletions
|
@ -116,7 +116,9 @@ and the given record. It then infers from the action name, that it should call
|
|||
`authorize` would have done something like this:
|
||||
|
||||
``` ruby
|
||||
raise "not authorized" unless PostPolicy.new(current_user, @post).update?
|
||||
unless PostPolicy.new(current_user, @post).update?
|
||||
raise Pundit::NotAuthorizedError, "not allowed to update? this #{@post.inspect}"
|
||||
end
|
||||
```
|
||||
|
||||
You can pass a second argument to `authorize` if the name of the permission you
|
||||
|
|
Loading…
Add table
Reference in a new issue