Reputation: 11
I've got the following controller
def detail
@book = get_book_details(params[:asin])
respond_to do |format|
format.html # index.html.erb
format.xml { render :xml => @booklists }
end
end
the unbundle lib get_book_details(asin), return a "book = Hash.new" like this:
book[:title]
book[:editorial_reviews]
book[:total_reviews]
...
and so on. In the view, I get the following
<%= h @book[:editorial_reviews]%>
The problem is that the content of @book[:editorial_reviews] is actually an HTML
substring, containing some fews tags I'd like to render.
Like that, I'll get those tags into the client browser view, but not interpreted and
sanitizing the string, result in missing some formatting layout which I'd like to
display instead.
How can I make the view render that inside html tags ???
Sorry for the newbie question. Thanks in advance lgs
Upvotes: 1
Views: 237
Reputation: 32629
The h
method escapes all the html tags. If you remove it, your html tags won't be escaped.
And you'll have your content appropriately formatted.
<%= @book[:editorial_reviews] %>
Upvotes: 1