I have a working Generic Action, but am trying to translate it into the Ash Read Action, less lines of code basically
I can’t for the hell of me pass the resource.argument to the prepare build() thing.
I probably don’t grasp quite well the hidden pipe happening and the function variables scopes. (action/argument, prepare fn, build fn).
I tried both of the ways, but I can’t get em both to work.
Neither Ash.Query.select worked (as if Ash.Query doesn’t exist)
Neither passing any variables into prepare build( ) seem to work! -.-
read :get_distinct_values2 do argument :column_name, :atom, allow_nil?: false prepare build(select: ([^column_name]) prepare fn action, context -> column_name = action.arguments.column_name action |> Ash.Query.select([^column_name]) |> Ash.Query.distinct([^column_name]) end end