1
0
Fork 0
mirror of https://github.com/varvet/pundit.git synced 2022-11-09 12:30:11 -05:00

Update README

This commit is contained in:
Linus Marton 2018-05-17 20:19:26 +02:00
parent 0b487f503d
commit dc7095118c
No known key found for this signature in database
GPG key ID: 3AE26AD3E41F5ED8

View file

@ -669,7 +669,7 @@ end
If you have defined an action-specific method on your policy for the current action, the `permitted_attributes` helper will call it instead of calling `permitted_attributes` on your controller.
If you need to fetch parameters based on namespaces different from the suggested one, override the below method and return an instance of `ActionController::Parameters`.
If you need to fetch parameters based on namespaces different from the suggested one, override the below method, in your controller, and return an instance of `ActionController::Parameters`.
```ruby
def pundit_params_for(record)
@ -685,7 +685,7 @@ def pundit_params_for(record)
params.fetch(PolicyFinder.new(record).param_key, {})
end
# If you are using something like the jsonapi spec
# If you are using something like the JSON API spec
def pundit_params_for(_record)
params.fetch(:data, {}).fetch(:attributes, {})
end