提交 df42d26f 编写于 作者: J Jeremy Kemper

Rename render_to_string to render_to_body since it may return any...

Rename render_to_string to render_to_body since it may return any Rack-compatible body, not just strings
上级 ecdc0643
......@@ -17,7 +17,7 @@ def _action_view
end
def render(options = {})
self.response_body = render_to_string(options)
self.response_body = render_to_body(options)
end
# Raw rendering of a template.
......@@ -26,7 +26,7 @@ def render(options = {})
# @option _layout<String> The relative path to the layout template to use
#
# :api: plugin
def render_to_string(options = {})
def render_to_body(options = {})
name = options[:_template_name] || action_name
template = options[:_template] || view_paths.find_by_parts(name.to_s, formats, options[:_prefix])
......@@ -55,4 +55,4 @@ def view_paths=(paths)
end
end
end
end
\ No newline at end of file
end
......@@ -58,4 +58,4 @@ def to_rack
response.to_a
end
end
end
\ No newline at end of file
end
......@@ -9,7 +9,7 @@ def _implied_layout_name
end
end
def render_to_string(options)
def render_to_body(options)
# render :text => ..., :layout => ...
# or
# render :anything_else
......@@ -34,4 +34,4 @@ def _layout_for_option(name)
end
end
end
\ No newline at end of file
end
......@@ -8,7 +8,7 @@ def initialize(*)
end
def render(action, options = {})
# TODO: Move this into #render_to_string
# TODO: Move this into #render_to_body
if action.is_a?(Hash)
options, action = action, nil
else
......@@ -17,10 +17,10 @@ def render(action, options = {})
_process_options(options)
self.response_body = render_to_string(options)
self.response_body = render_to_body(options)
end
def render_to_string(options)
def render_to_body(options)
unless options.is_a?(Hash)
options = {:action => options}
end
......@@ -59,4 +59,4 @@ def _process_options(options)
end
end
end
end
\ No newline at end of file
end
......@@ -134,7 +134,7 @@ def _layout
self.class.layout(formats)
end
def render_to_string(options = {})
def render_to_body(options = {})
options[:_layout] = options[:layout] || _layout
super
end
......@@ -223,4 +223,4 @@ def assert_dispatch(klass, body = "success", action = :index)
end
end
end
\ No newline at end of file
end
......@@ -23,7 +23,7 @@ def self.controller_path
def controller_path() self.class.controller_path end
def render_to_string(options)
def render_to_body(options)
options[:_layout] = _default_layout
super
end
......@@ -229,4 +229,4 @@ class ::BadOmgFailLolLayout < AbstractControllerTests::Layouts::Base
end
end
end
end
\ No newline at end of file
end
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册