We use render inline:
in view rendering:
<%= render inline: ERB.new(@erb_code).result(binding)
Here @erb_code
returns a string for view code for rendering. The code worked fine until a form_tag
was added to @erb_code
. The error is:
(erb):8: syntax error, unexpected ')'
...@project.id), method: :get do ).to_s); _erbout.concat "\r\n\...
... ^
(erb):63: syntax error, unexpected end-of-input, expecting ')'
; _erbout.force_encoding(__ENCODING__)
^
Here is the form_tag
code added:
<%= form_tag onboard_engine_configs_path(format: "csv", :project_id => @project.id), method: :get do %>
<%= label_tag(:from_release, "Release") %>
<%= select_tag(:from_release, options_for_select(releases.select('id, name').map{|r| [r.name, r.id]})) %>
<%= submit_tag 'CSV' %>
<% end %>
If rendering @erb_code directly, then there is no error.
We know the problem is with the render inline:
. Tried render inline: @erb_code
and the error is the same. How to escape form_tag
in render inline:
?
Aucun commentaire:
Enregistrer un commentaire