Skip to content

Commit a53a88e

Browse files
authored
Merge pull request rails#33418 from azbshiri/document-renderer
[ci skip] Document render options
2 parents 20543c0 + 905d848 commit a53a88e

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

actionpack/lib/action_controller/renderer.rb

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,21 @@ def initialize(controller, env, defaults)
7171
end
7272

7373
# Render templates with any options from ActionController::Base#render_to_string.
74+
#
75+
# The primary options are:
76+
# * <tt>:partial</tt> - See <tt>ActionView::PartialRenderer</tt> for details.
77+
# * <tt>:file</tt> - Renders an explicit template file. Add <tt>:locals</tt> to pass in, if so desired.
78+
# It shouldn’t be used directly with unsanitized user input due to lack of validation.
79+
# * <tt>:inline</tt> - Renders a ERB template string.
80+
# * <tt>:plain</tt> - Renders provided text and sets the content type as <tt>text/plain</tt>.
81+
# * <tt>:html</tt> - Renders the provided HTML safe string, otherwise
82+
# performs HTML escape on the string first. Sets the content type as <tt>text/html</tt>.
83+
# * <tt>:json</tt> - Renders the provided hash or object in JSON. You don't
84+
# need to call <tt>.to_json<tt> on the object you want to render.
85+
# * <tt>:body</tt> - Renders provided text and sets content type of <tt>text/plain</tt>.
86+
#
87+
# If no <tt>options</tt> hash is passed or if <tt>:update</tt> is specified, the default is
88+
# to render a partial and use the second parameter as the locals hash.
7489
def render(*args)
7590
raise "missing controller" unless controller
7691

0 commit comments

Comments
 (0)