Inserting HTML into your rails view
When inserting html into your rails view from a record, you might do it in one of two similar ways:
<%= @webpage.content.html_safe %>
<%= raw @webpage.content %>
This can also be accomplished by adding in another =
<%== @webpage.content %>
<%== %>
is equivalent to raw
, and raw
calls html_safe
on whatever it is passed.
h/t Matt Polito
Tweet