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:
But when I try to use in heex template the form with the following code:
I get the following in the picure attached.
I can't figure out what I'm doing wrong.

20 Replies
In the new phoenix versions, it is expected that you will assign the result of calling
to_form/1
on the ash form
We’ve updated all of the functions to be able to take a phoenix form as inputok thanks
to be clear do I only have to add this?
cause now the form works but it doesn't autopopulate the input fields
That should be it, yes. What do you mean when you say that it doesn't auto populate the input fields?
The input fields of the form should have the values of the resource in this case the merchant resource
🤔 AFAIK the
to_form/1
shouldn't affect that. Are you using phoenix's builtin components?
like the core_components.ex
?Yes I'm using the simple_form and the input components
But the fileds are blank
Although current_merchant has values
but not when you do
to_form/1
?Yes even when I use that
So after making the form, try doing
AshPhoenix.Form.value(form, :company_name)
and see what it saysOk
it returns
nil
strange
tried with some other values and the result is the same
maybe I did something wrong
it's not the forms fault
because current_merchant has nil values I checked
nowstrange, but yeah in that case likely something in the way
current_merchant
is setIt's set by ash auth beacuse merchant is a user
What I could do is query the database for the merchant but seems a waste
Maybe there is a better way
But right now I can't think of anything
🤔
Ash auth should select everything by default
now I'm at the point where current_merchant has the values but doing
AshPhoenix.Form.value
returns nil
should return Porco dio
the complete mount code is:
very strange
It's driving me insane
I tried with other fields and with another merchant but the result is the same nil
Is
:update_details
an update action in the resource?
What does form.source.type
sayyes it is defined like so:
it says
:update
Hmm…what happens if you take this
set_new_attribute
calls out?okay that was the problem
now works
I think I didn't understand change corretly
in this case it is not needed to explicitly set change
(?)
Yeah, so all public attributes are accepted by defaults
You don’t need to ferry them through with arguments
accept [:foo, :bar, :baz]
let’s you control which attributes are acceptedoh I see
understood thanks a lot