diff options
Diffstat (limited to 'actionpack/lib/action_controller/abstract/renderer.rb')
-rw-r--r-- | actionpack/lib/action_controller/abstract/renderer.rb | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/actionpack/lib/action_controller/abstract/renderer.rb b/actionpack/lib/action_controller/abstract/renderer.rb index 2a68f048bd..a86eef889e 100644 --- a/actionpack/lib/action_controller/abstract/renderer.rb +++ b/actionpack/lib/action_controller/abstract/renderer.rb @@ -40,7 +40,7 @@ module AbstractController # # :api: plugin def render_to_string(options = {}) - Rack::Utils.body_to_s(render_to_body(options)).to_ary.join + AbstractController::Renderer.body_to_s(render_to_body(options)) end def _render_template(template, options) @@ -49,6 +49,18 @@ module AbstractController def view_paths() _view_paths end + # Return a string representation of a Rack-compatible response body. + def self.body_to_s(body) + if body.respond_to?(:to_str) + body + else + strings = [] + body.each { |part| strings << part.to_s } + body.close if body.respond_to?(:close) + strings.join + end + end + module ClassMethods def append_view_path(path) |