You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
What I expect: On form.save (or form.sync and then twin.sync), the form writes the values from the params hash to the twin and the twin then writes the values to the nested objects without reassigning the nested properties.
What actually happens: Reform assigns the nested Twin (i.e. an instance of the anonymous class it generates to wrap the nested model) to the model:
# before save:user.profile.class# => Profile ... and should stay that way# now we save:form.save# what happened to the nested object?user.profile.class# => #<Class:0x007fb403211358># ...which is the anonymous class generated by the twin to wrap the nested profile model:twin.profile.class# => #<Class:0x007fb403211358>
Additional info: If you don't use a form but assign the values to the twin manually, twin.sync will work as expected:
Reform version: 2.2.1
Given: I have a very complex data structure which I compose into a Twin with nested properties. The Twin then serves as model for a Form:
What I expect: On
form.save
(orform.sync
and thentwin.sync
), the form writes the values from the params hash to the twin and the twin then writes the values to the nested objects without reassigning the nested properties.What actually happens: Reform assigns the nested Twin (i.e. an instance of the anonymous class it generates to wrap the nested model) to the model:
Additional info: If you don't use a form but assign the values to the twin manually,
twin.sync
will work as expected:So the problematic behavior is in Reform.
The text was updated successfully, but these errors were encountered: