Skip to content

Policy scopes for different actions #829

Answered by Burgestrand
Floppy asked this question in Q & A
Discussion options

You must be logged in to vote

Is that right? Am I thinking about scopes wrong? Should they be able to answer the question "show me all the pets I can edit?". Does it, in fact, already handle this and I've just missed something really obvious?

This issue might be of interest: #368

I haven't dug into this particular issue in a while, so take this summary with a large grain of salt:

  • use different scopes (i.e. ShowScope and EditScope)
  • use different methods on the scope (e.g. Scope#show, Scope#edit)

These suggestions encourage separating different concepts by mapping each concept to one scope/method. Pundit doesn't have an opinion on which one you should use, or how to approach it. Luckily Pundit is effectively a small…

Replies: 1 comment 2 replies

Comment options

You must be logged in to vote
2 replies
@Floppy
Comment options

@Burgestrand
Comment options

Answer selected by Floppy
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q & A
Labels
None yet
2 participants