Allow HTML String - Ruby on Rails

GuidesRuby on RailsWeb Development

Just a quick post on how to prevent escaping for HTML within a string. Simply use html_safe?.

i.e. The following will show the bold tags as text:

<%= "<b>GOOOOOOOGLE</b>">

GOOOOOOOGLE

Whereas once we add html_safe the text will be displayed in bold:

<%= ("<b>GOOOOOOOGLE</b>").html_safe?>

GOOOOOOOGLE