views:

10

answers:

1

I have an intstance variable I am passing to a view, @body.

@body is a string with html in it.

<%= @body %> renders the string, not the html. How do I render the html in the string?

Possible?

Thanks in advance!

A: 

<%= @body %> would output some html if you had some html in @body. It's a little weird to have html in that variable since the controller is not supposed to pass any HTML (The controller has to be view agnostic).

This is why we have some helper methods. Make a helper method that generates some html, and use it in your view.

Nicolas Viennot
Doh! I was using <%=h %>. I understand the view agnostic thing, this is just a weird situation where I am passing an html-formatted email through to view. Thanks!
Stirman
h() will escape your html :)
Nicolas Viennot