Ash FrameworkAF
Ash Framework8mo ago
4 replies
maccachan0009

inputs_for not working when I do manage_relationship in Ash.Changeset.before_action

Hi team,
I would like to ask smth about inputs_for, so when I do manage relatioinship this way change manage_relationship(:beds, type: :create) in the action, inputs_for works.

But when I put the manage_relationship in before_action, it doesn't work, e.g.:
change fn changeset, %{actor: actor} = _context -> 
        Ash.Changeset.before_action(changeset, fn changeset ->
          beds = Ash.Changeset.get_argument(changeset, :beds)

          Ash.Changeset.manage_relationship(changeset, :beds, beds, type: :create)
end

It has this error:
** (AshPhoenix.Form.NoFormConfigured) beds at path [] must be configured in the form to be used with `inputs_for`. For example:

There is an argument called `beds` on the action `MealReports.AshDomains.Lodging.RoomType.create`.

Perhaps you are missing a `change manage_relationship` for that argument, or it is not a type that can have forms generated for it?


How can I make inputs_for work when I need to do manage_relationship in the change function? Thanks so much.
Was this page helpful?