Ash FrameworkAF
Ash Framework4mo ago
8 replies
Songyun

Anonymous Function Queries (Preparations)

I can't seem to get the syntax right, what am I doing wrong?

  preparations do
    prepare fn query, context ->
      case query.tenant do
        %MyApp.Orgs.Org{id: id} ->
          query
          |> Ash.Query.filter(org_id == ^id)

        _ ->
          query
      end
    end
  end


It yells at me for the org_id var and use of the pin operator. I tried without (org_id: id) and got a different error.
Was this page helpful?