D
D
Dmitry Amelchenko2016-03-11 11:00:28
Ruby on Rails
Dmitry Amelchenko, 2016-03-11 11:00:28

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

1 answer(s)
A
Alexey Poimtsev, 2016-03-11
@poimtsev

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 question

Ask a Question

731 491 924 answers to any question