Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Rack::Utils.body_to_s doesn't exist in 1.0

  • Loading branch information...
commit 70c544df71dbea561d6136ecb13bee43cda64bd1 1 parent f49e344
@jeremy jeremy authored
View
14 actionpack/lib/action_controller/abstract/renderer.rb
@@ -40,7 +40,7 @@ def render_to_body(options = {})
#
# :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 @@ def _render_template(template, options)
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)
View
4 actionpack/lib/action_controller/base/render.rb
@@ -1,3 +1,5 @@
+require 'action_controller/abstract/renderer'
+
module ActionController
DEFAULT_RENDER_STATUS_CODE = "200 OK"
@@ -318,7 +320,7 @@ def render_to_body(options = nil, &block) #:doc:
end
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
# Clears the rendered results, allowing for another render to be performed.
Please sign in to comment.
Something went wrong with that request. Please try again.