Fix param handling
This fixes two things:
a) It picks up the correct action (not from the changeset but from the parent form) b) It fixes handling parameters for cardinality :many
If you remove the first commit you will see the test is failing and it will produce the incorrect form.
Instead of generating two forms per polymorphic type it will generate only one form for the device type
This PR seems to fix some of the immediate form validation problems I was having (even though the issue you were mentioning this PR in (#113) is about polymorphic_embeds_many, and I was having trouble with polymorphic_embeds_one).
There seems to be one failing test though
1) test form with improved param handling for different param types (PolymorphicEmbedTest)
test/polymorphic_embed_test.exs:3234
Assertion with == failed
code: assert f.params == %{"ref" => "789"}
left: %{"0" => %{"ref" => "789"}, "1" => %{"address" => "012 Oak Ave"}}
right: %{"ref" => "789"}
I am not sure why this is happening though, as right now I didn't dive deep enough into phoenix form handling yet. Maybe it is happening because recent changes in phoenix html/form handling?
Furthermore, you mentioned in #113 that there were issues with the sort params as well, specifically with the approach taken in this PR.
Did you find some time to have another look at this yet @nduitz ?
Hey there, we are currently running this branch in our project which works well so far: https://github.com/nduitz/polymorphic_embed/commits/patch-2
One thing I noticed yesterday which caused me a lot of headaches was that polymorphic_embed_inputs_for does not render hidden id inputs even though we do not specify skip_hidden: true.
Will look into that once we finished implementing all forms and continue to refine them.
Hey there, we are currently running this branch in our project which works well so far: https://github.com/nduitz/polymorphic_embed/commits/patch-2
One thing I noticed yesterday which caused me a lot of headaches was that
polymorphic_embed_inputs_fordoes not render hidden id inputs even though we do not specifyskip_hidden: true. Will look into that once we finished implementing all forms and continue to refine them.
Never mind my comment about polymorphic_embed_inputs_for not rendering a hidden id field. That is the same for the inputs_for implementation of phoenix_live_view. Somehow I assumed inputs_for does this.