Skip to content

Instantly share code, notes, and snippets.

@jpgeek
jpgeek / gist:3958309
Created October 26, 2012 11:37
Rails 3 HTML escaping
String output from html helpers like link_to are html_safe.
In the console:
lnk = helper.link_to('home', '/')
=> "<a href=\"/\">home</a>"
lnk.html_safe?
=> true
However, if you have html-ish stuff in the text arguments to the helper,
it must be html_safe blessed: