aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/lib/abstract_controller/rendering.rb
diff options
context:
space:
mode:
authorJosé Valim <jose.valim@gmail.com>2011-05-01 12:56:04 +0200
committerJosé Valim <jose.valim@gmail.com>2011-05-01 13:40:13 +0200
commitb73576138529b1344a38f4e4b16c642f3510d514 (patch)
treeaf20defc605263df77a2bd22f50103a4c6eacf15 /actionpack/lib/abstract_controller/rendering.rb
parent367bdc53611fe1da9cedda3220a83d3f39409cff (diff)
downloadrails-b73576138529b1344a38f4e4b16c642f3510d514.tar.gz
rails-b73576138529b1344a38f4e4b16c642f3510d514.tar.bz2
rails-b73576138529b1344a38f4e4b16c642f3510d514.zip
Introduce view renderer.
Diffstat (limited to 'actionpack/lib/abstract_controller/rendering.rb')
-rw-r--r--actionpack/lib/abstract_controller/rendering.rb13
1 files changed, 11 insertions, 2 deletions
diff --git a/actionpack/lib/abstract_controller/rendering.rb b/actionpack/lib/abstract_controller/rendering.rb
index 306bd41e2d..db6ff41f55 100644
--- a/actionpack/lib/abstract_controller/rendering.rb
+++ b/actionpack/lib/abstract_controller/rendering.rb
@@ -99,7 +99,12 @@ module AbstractController
#
# Override this method in a module to change the default behavior.
def view_context
- view_context_class.new(lookup_context, view_assigns, self)
+ view_context_class.new(view_renderer, view_assigns, self)
+ end
+
+ # Returns an object that is able to render templates.
+ def view_renderer
+ @view_renderer ||= ActionView::Renderer.new(lookup_context, self)
end
# Normalize arguments, options and then delegates render_to_body and
@@ -127,7 +132,11 @@ module AbstractController
# Find and renders a template based on the options given.
# :api: private
def _render_template(options) #:nodoc:
- view_context.render(options)
+ if options.key?(:partial)
+ view_renderer.render_partial(view_context, options)
+ else
+ view_renderer.render_template(view_context, options)
+ end
end
# The prefixes used in render "foo" shortcuts.