I am trying to insert html with a render_to_string of a partial that contain a , the problem is that this script does not run, is there any way to rerun the inserted scripts?
ref. I am using Cable Ready morph to insert the html. I have inspected the DOM and the partial is inserted correctly in the view, but the script does not execute.
I really appreciate any help, thanks
cable_ready['workflow'].morph(
selector: '#active_' + ActionView::RecordIdentifier.dom_id(attention_request),
html: render_to_string(
partial: "payments/partial",
locals: {
professional_quote: professional_quote,
}
)
)
cable_ready.broadcast
partial.html.erb
<%= form_tag payments_mercado_pago_payments_path, method: :post, class: '' do %>
<script
src="https://www.mercadopago.com.ar/integrations/v1/web-payment-checkout.js"
data-preference-id="<%= professional_quote.preference_id %>">
</script>
<% end %>