Loading multitenant resources
Given the following action:
I'm listing orgs and need to load their child establishments (which have a multitenancy attribute configured via
organization_id
). It throws an error saying I need to specify a tenant to load the establishments. How would I set the tenant here?Solution:Jump to solution
```elixir
read :list_organizations do
prepare build(load: [:establishments])
multitenancy :bypass_all
end...
12 Replies
This is something that we need to add support for but for now you need to roll yourself by bypassing multitenancy in the target action
there is a new option, I think we've just released it
Solution
try that out
I've upgraded the Ash version to 3.5 and still encountered the error. Maybe I need to upgrade another dep?
Which version specifically are you on?
It was released in 2.5.25
That's not necesssrily the version you are using
mix hex.info ash
Locked version: 3.5.23you are not on the latest version
mix deps.update ash
Oh you meant 3.5.25
This upgraded it to the latest version!
Thanks, now the
:bypass_all
is available and my read action is loading the relationship
Although I'm still getting the DSL error in my editor
Still shows the old version
Elixir LS is weird sometimes 🤷♂️
Deleting the .elixir-ls folder and recompiling solved it
Thanks Zach!