aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/lib/action_controller/abstract
diff options
context:
space:
mode:
authorJeremy Kemper <jeremy@bitsweat.net>2009-04-21 16:02:30 -0700
committerJeremy Kemper <jeremy@bitsweat.net>2009-04-21 16:02:30 -0700
commitf49e3441280380ec810d54bd5a77a7e699415efb (patch)
tree6d5578830513259a3a3df0d7480f2a1d3b46cacc /actionpack/lib/action_controller/abstract
parent504d16ccdfcd689eac31c1646957b06cc0ce55d1 (diff)
downloadrails-f49e3441280380ec810d54bd5a77a7e699415efb.tar.gz
rails-f49e3441280380ec810d54bd5a77a7e699415efb.tar.bz2
rails-f49e3441280380ec810d54bd5a77a7e699415efb.zip
Reinstate Base#render_to_string. Introduce AbstractController#render_to_string which stringifies render_to_body.
Diffstat (limited to 'actionpack/lib/action_controller/abstract')
-rw-r--r--actionpack/lib/action_controller/abstract/renderer.rb12
1 files changed, 11 insertions, 1 deletions
diff --git a/actionpack/lib/action_controller/abstract/renderer.rb b/actionpack/lib/action_controller/abstract/renderer.rb
index eb248652a8..2a68f048bd 100644
--- a/actionpack/lib/action_controller/abstract/renderer.rb
+++ b/actionpack/lib/action_controller/abstract/renderer.rb
@@ -20,7 +20,7 @@ module AbstractController
self.response_body = render_to_body(options)
end
- # Raw rendering of a template.
+ # Raw rendering of a template to a Rack-compatible body.
# ====
# @option _prefix<String> The template's path prefix
# @option _layout<String> The relative path to the layout template to use
@@ -33,6 +33,16 @@ module AbstractController
_render_template(template, options)
end
+ # Raw rendering of a template to a string.
+ # ====
+ # @option _prefix<String> The template's path prefix
+ # @option _layout<String> The relative path to the layout template to use
+ #
+ # :api: plugin
+ def render_to_string(options = {})
+ Rack::Utils.body_to_s(render_to_body(options)).to_ary.join
+ end
+
def _render_template(template, options)
_action_view._render_template_with_layout(template)
end