Is there a way to use tenant in expr?

I expected that there would be tenant in the context, but it’s not there.

expr(companies.id == ^context(:tenant)) # <-- tenant isn't in context

I don’t think so currently. I think you will need to do it functionally, i.e

prepare fn query, _ -> 
  Ash.Query.filter(query, expr(...^query.tenant))
end
2 Likes

Is this on the to-do list, or will it not be implemented in the near future?

It is not currently on the roadmap, but if it turns out to be necessary then we could potentially add it.

3 Likes