Closed revickulous2001 closed 4 years ago
I suspect the issue here is that the form builder contains a reference to the view context. We can probably get around this by providing custom _marshal_dump
and _marshal_load
implementations for this object.
In the meantime, a simple workaround would be to move the form_with
into the component and pass in the model
instead.
I was trying to pass a form builder object into a ViewComponent that is using motion. Doing something like:
Is throwing
Motion::UnrepresentableStateError
.This seems to be because Motion is trying to
Marshal.dump
the component state and that is conflicting with the form builder object.If I can't pass the form builder object in this way, how would I be able to use Motion to render some code within the component such as:
<%= form_object.fields_for :association %>
? Is there a workaround to this or am I simply doing something wrong?