Reputation: 772
I have something like the following:
<%= content_tag(:table, class: "table") do %>
…
Rows and cells etc
…
<% end %>
I want to output it as raw HTML for users to copy-and-paste. How do I do that?
Can I wrap the entire block in something like <%= raw do %>…<% end %>
? (That obviously doesn't work BTW)
Upvotes: 0
Views: 79
Reputation: 1703
CGI::escapeHTML
can do it. You should be able to call
<%= CGI.escapeHTML content_tag(:table, class: "table") do %>
...
<% end %>
Update, better way:
The h
method, of course!
<%=h content_tag(:table, class: "table") do %>
...
<% end %>
Upvotes: 2