Declarative_Athorization: with_permissions_to for all models on single place
-
29-09-2019 - |
Question
Is there a way to have with_permissions_to in a single place globally so that it applies to EVERY finder method of all models.
Actually, I have very big application and just added this plug-in for authorization. I don't want to use with_permissions_to with every find method for all models.
Thanks, Imran
Solution
Try adding:
default_scope { with_permissions_to(:read) }
to your models
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow