README.md in jsonapi-authorization-0.8.0 vs README.md in jsonapi-authorization-0.8.1
- old
+ new
@@ -97,9 +97,19 @@
JSONAPI::Authorization.configure do |config|
config.authorizer = MyCustomAuthorizer
end
```
+By default JSONAPI::Authorization uses the `:user` key from the JSONAPI context hash as the Pundit user. If you would like to use `:current_user` or some other key, it can be configured as well.
+
+```ruby
+JSONAPI::Authorization.configure do |config|
+ config.pundit_user = :current_user
+ # or a block can be provided
+ config.pundit_user = ->(context){ context[:current_user] }
+end
+```
+
## Troubleshooting
### "Unable to find policy" exception for a request
The exception might look like this for resource class `ArticleResource` that is backed by `Article` model: