aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/lib/action_controller
diff options
context:
space:
mode:
authorJeremy Kemper <jeremy@bitsweat.net>2009-04-22 00:23:47 -0700
committerJeremy Kemper <jeremy@bitsweat.net>2009-04-22 00:23:47 -0700
commite9ed44af88fcffe75e1658e963e6dfb26b31edbe (patch)
tree1a3c641f02b9b0b0bda0c85574f45c052ec62a03 /actionpack/lib/action_controller
parent5afc2abee66cda565f2cb890fe11c3d8e918d882 (diff)
parent6ee8329af6cd0c62945f216fae80fdd1679d477d (diff)
downloadrails-e9ed44af88fcffe75e1658e963e6dfb26b31edbe.tar.gz
rails-e9ed44af88fcffe75e1658e963e6dfb26b31edbe.tar.bz2
rails-e9ed44af88fcffe75e1658e963e6dfb26b31edbe.zip
Merge branch 'master' into cherry
Diffstat (limited to 'actionpack/lib/action_controller')
-rw-r--r--actionpack/lib/action_controller/abstract/renderer.rb14
-rw-r--r--actionpack/lib/action_controller/base/render.rb4
2 files changed, 16 insertions, 2 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)
diff --git a/actionpack/lib/action_controller/base/render.rb b/actionpack/lib/action_controller/base/render.rb
index 604dd31930..606df58518 100644
--- a/actionpack/lib/action_controller/base/render.rb
+++ b/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 @@ module ActionController
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.