Ash FrameworkAF
Ash Framework3y ago
56 replies
samoorai

AshPhoenix.Form does not implement the Access behaviour

I'm having this problem when I try to use AshPhoenixForms.
I have a liveview with this mount function:
  @impl true
  def mount(_conn, _session, socket) do
    current_merchant = socket.assigns.current_merchant

    form =
      AshPhoenix.Form.for_action(current_merchant, :update_details,
        as: "merchant",
        api: Newco.Accounts,
        actor: current_merchant
      )
    {:ok, assign(socket, form: form)}
  end


But when I try to use in heex template the form with the following code:

      <.simple_form
        for={@form}
        as={:merchant}
        id="merchant-form"
        phx-submit="save"
      >
        <.input field={@form[:company_name]} />
        <:actions>
          <.button phx-disable-with="Saving...">Save Tweet</.button>
        </:actions>
      </.simple_form>
    </div>


I get the following in the picure attached.

I can't figure out what I'm doing wrong.
image.png
Was this page helpful?