Using add_form with a many_to_many relationship
Trying to use
add_form
on a many_to_many
relationship. Here is my action and relationship.
I using add_form
to add an Organization as a member after search for one.
And the form:
If there are existing members then they will render fine and there are hidden inputs as expected, but any member I added via add_form
does not have the id added as a hidden field. It is in the params.
I don't want to create Organizations in the nested form only associate them via the members many_to_many
relationship.3 Replies
The other thing I notices is that I can't even save the CampaignTargetList when I just change the name. The existing members have errors with any changes.
You might find this guide useful, its not published yet - https://ash-project.github.io/ash_phoenix/forms-for-relationships-between-existing-records.html basically, you want to be working with IDs of the related records, not maps
thank you. I will give it a try.
This works and makes much more sense to work with IDs.