Answer the question
In order to leave comments, you need to log in
How to restrict access for an index action using Pundit?
There are three models User, Department, Task. The standard user is bound to the departament_id via the belongs_to relationship. What is the best way to write a policy so that when a user sends a request to localhost:3000/tasks he can see the tasks of his department only?
Answer the question
In order to leave comments, you need to log in
Have a look at the Scopes section in the Pundit documentation - https://github.com/elabs/pundit#scopes
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question