The organization list gets loaded no problem, but the inner projects is always empty (and the aggregate count is 0) because it does not pass the policy check. When I put authorize if always it does load then.
In the projects resource I have
policy action_type(:read) do authorize_if accessing_from(Organization, :organization)end
policy action_type(:read) do authorize_if accessing_from(Organization, :organization)end
In my understanding the accessing from should see that the project is being loaded from the organization (which in turn is being loaded in a prepare from User) and authorize it.
The Elixir backend framework for unparalleled productivity. Declarative tools that let you stop wasting time. Use with Phoenix LiveView or build APIs in minutes for your front-end of choice.