I've been having the problem of trying to output generated HTML into a ruby view template in a similar fashion to this:
<%= generatedhtml %>
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 "htmlsafe" function as follows:
<%= generatedhtml.htmlsafe %>