Skip to content

Conversation

@nduitz
Copy link

@nduitz nduitz commented Aug 12, 2025

I don't know if this is the best way of dealing with it.

The problem of the previous code is, that there was no way of matching existing data to form_params for polymorphic_embeds_many.

The reason is simple. form params are typically string keys and are passed as such to the changeset.
The previous code only did look at :id when trying to find existing data to apply changes to.

Now the cast method also checks for params[persistent_id] which is automatically added by polymorphic_inputs_for
This way data that isn't send forth and back by the form will persist in changesets.

@nduitz
Copy link
Author

nduitz commented Aug 18, 2025

This won't work when adding/removing inputs dynamically using sort_param and drop_param. I'll take a closer look and implement more tests

@nduitz
Copy link
Author

nduitz commented Aug 19, 2025

this seems to be unnecessary with this patch:
#132

Therefore I will close it.

@nduitz nduitz closed this Aug 19, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant