Skip to content

Is there an easy way to get the policy's associated class? #247

Answered by palkan
keithlayne asked this question in Q&A
Discussion options

You must be logged in to vote

but does my hypothetical model_class already exist somewhere?

Nope. The model_class depends solely on the naming convention used, so it's up to the end user; we do not enforce anything like this in the code.

Part of my rationale here is that it's pretty important for the show rule to match the scope, and if/when the logic changes I've had to update both, and maintain exhaustive tests to make sure those two agree for all context/record combinations.

Yeah, scoping-based authorization is a popular technique; however, in my experience it can lead to performance issues; in most cases, a singleton show? implementation can be much more efficient than using scopes. To keep them in sync, we ca…

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by keithlayne
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