Unescape HTML output in Rails 3 using html_safe
I've been having the problem of trying to output generated HTML into a ruby view template in a similar fashion to this:
<%= generated_html %>
The problem is in Rails 3 you no longer need the "h" function which escapes HTML. This is now done automatically.
The solution is to tell rails that this is safe HTML and you want to unescape the output using the "html_safe" function as follows:
<%= generated_html.html_safe %>
Published on Wednesday 6th of October 2010