how to output text containing html markup without having the browser render the html

I have an object attribute that constantly gets html inserted into it. This becomes problematic when I want to output that attribute to the browser. What I'd like to do is have the < and > converted to &lt; and &gt;. Is there a snippet or plugin I can use to do this?

I have an object attribute that constantly gets html inserted into it. This becomes problematic when I want to output that attribute to the browser. What I'd like to do is have the < and > converted to &lt; and &gt;. Is there a snippet or plugin I can use to do this?

Assuming your attribute is say @html_string...

<%= h @html_string %>

-philip

You mean like the view helper h(), as in <%=h my_attr %>?

Exactly. Thank you.