mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
Rename render_to_string to render_to_body since it may return any Rack-compatible body, not just strings
This commit is contained in:
parent
ecdc0643f2
commit
df42d26f99
6 changed files with 14 additions and 14 deletions
|
@ -17,7 +17,7 @@ module AbstractController
|
||||||
end
|
end
|
||||||
|
|
||||||
def render(options = {})
|
def render(options = {})
|
||||||
self.response_body = render_to_string(options)
|
self.response_body = render_to_body(options)
|
||||||
end
|
end
|
||||||
|
|
||||||
# Raw rendering of a template.
|
# Raw rendering of a template.
|
||||||
|
@ -26,7 +26,7 @@ module AbstractController
|
||||||
# @option _layout<String> The relative path to the layout template to use
|
# @option _layout<String> The relative path to the layout template to use
|
||||||
#
|
#
|
||||||
# :api: plugin
|
# :api: plugin
|
||||||
def render_to_string(options = {})
|
def render_to_body(options = {})
|
||||||
name = options[:_template_name] || action_name
|
name = options[:_template_name] || action_name
|
||||||
|
|
||||||
template = options[:_template] || view_paths.find_by_parts(name.to_s, formats, options[:_prefix])
|
template = options[:_template] || view_paths.find_by_parts(name.to_s, formats, options[:_prefix])
|
||||||
|
@ -55,4 +55,4 @@ module AbstractController
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -58,4 +58,4 @@ module ActionController
|
||||||
response.to_a
|
response.to_a
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -9,7 +9,7 @@ module ActionController
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def render_to_string(options)
|
def render_to_body(options)
|
||||||
# render :text => ..., :layout => ...
|
# render :text => ..., :layout => ...
|
||||||
# or
|
# or
|
||||||
# render :anything_else
|
# render :anything_else
|
||||||
|
@ -34,4 +34,4 @@ module ActionController
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -8,7 +8,7 @@ module ActionController
|
||||||
end
|
end
|
||||||
|
|
||||||
def render(action, options = {})
|
def render(action, options = {})
|
||||||
# TODO: Move this into #render_to_string
|
# TODO: Move this into #render_to_body
|
||||||
if action.is_a?(Hash)
|
if action.is_a?(Hash)
|
||||||
options, action = action, nil
|
options, action = action, nil
|
||||||
else
|
else
|
||||||
|
@ -17,10 +17,10 @@ module ActionController
|
||||||
|
|
||||||
_process_options(options)
|
_process_options(options)
|
||||||
|
|
||||||
self.response_body = render_to_string(options)
|
self.response_body = render_to_body(options)
|
||||||
end
|
end
|
||||||
|
|
||||||
def render_to_string(options)
|
def render_to_body(options)
|
||||||
unless options.is_a?(Hash)
|
unless options.is_a?(Hash)
|
||||||
options = {:action => options}
|
options = {:action => options}
|
||||||
end
|
end
|
||||||
|
@ -59,4 +59,4 @@ module ActionController
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -134,7 +134,7 @@ module AbstractController
|
||||||
self.class.layout(formats)
|
self.class.layout(formats)
|
||||||
end
|
end
|
||||||
|
|
||||||
def render_to_string(options = {})
|
def render_to_body(options = {})
|
||||||
options[:_layout] = options[:layout] || _layout
|
options[:_layout] = options[:layout] || _layout
|
||||||
super
|
super
|
||||||
end
|
end
|
||||||
|
@ -223,4 +223,4 @@ module AbstractController
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -23,7 +23,7 @@ module AbstractControllerTests
|
||||||
|
|
||||||
def controller_path() self.class.controller_path end
|
def controller_path() self.class.controller_path end
|
||||||
|
|
||||||
def render_to_string(options)
|
def render_to_body(options)
|
||||||
options[:_layout] = _default_layout
|
options[:_layout] = _default_layout
|
||||||
super
|
super
|
||||||
end
|
end
|
||||||
|
@ -229,4 +229,4 @@ module AbstractControllerTests
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue