From 920f3ba2668e0622335f16f2f1318d9e6b5e6b28 Mon Sep 17 00:00:00 2001 From: Prem Sichanugrist Date: Fri, 14 Feb 2014 09:57:47 -0500 Subject: Introduce `render :html` for render HTML string This is an option for to HTML content with a content type of `text/html`. This rendering option calls `ERB::Util.html_escape` internally to escape unsafe HTML string, so you will have to mark your string as html safe if you have any HTML tag in it. Please see #12374 for more detail. --- actionview/lib/action_view/helpers/rendering_helper.rb | 3 +++ 1 file changed, 3 insertions(+) (limited to 'actionview/lib/action_view/helpers/rendering_helper.rb') diff --git a/actionview/lib/action_view/helpers/rendering_helper.rb b/actionview/lib/action_view/helpers/rendering_helper.rb index 4eae80cd93..15b88bcda6 100644 --- a/actionview/lib/action_view/helpers/rendering_helper.rb +++ b/actionview/lib/action_view/helpers/rendering_helper.rb @@ -14,6 +14,9 @@ module ActionView # * :text - Renders the text passed in out. # * :plain - Renders the text passed in out. Setting the content # type as text/plain. + # * :html - Renders the html safe string passed in out, otherwise + # performs html escape on the string first. Setting the content type as + # text/html. # * :body - Renders the text passed in, and does not set content # type in the response. # -- cgit v1.2.3