1
0
Fork 0
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:
Nathan Long 2016-11-16 09:13:13 -05:00 committed by GitHub
parent 409f9e0030
commit 72c6c1a606

View file

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