Global hooks

Is there any mechanism to run a before hook for any action of any resource? I have a tenant that is an org, and an actor that is a membership. Membership also has a team association I want to load in the context of any action. What would be the best way to achieve that?
2 Replies
barnabasj
barnabasj3mo ago
You can do that by either creating a Base Resource or writing an extension. But I'm not sure I would do it this way, I feel like it could lead to you doing a lot of unecessary loads. Most of the time you would load the actor with the membership and the org in a Plug and use the PlugHelper to make them available in LiveView or AshJsonApi...
Marco Dell'Olio
Marco Dell'OlioOP3mo ago
ok thank you for the answer!

Did you find this page helpful?