Ash FrameworkAF
Ash Framework3y ago
10 replies
Blibs

Generic action has `api` nil in context when called from `code_interface`

I have a generic action in my resource:

    action :blibs, :any do
      run fn _, context ->
        __MODULE__
        |> Ash.Query.filter(...)
        context.api.read() 
      end
    end


and I have it set in that resource code_interface:

  code_interface do
    define_for FeedbackCupcake.Accounts

    define :blibs
  end


Since I have the define_for in the code_interface I was expecting that the generic action context will have the api key filled with FeedbackCupcake.Accounts so I can fetch it and use in to call
read
function.

Is this a bug? If not, how can I figure out what is the API I should call that function in this case?
Was this page helpful?