From f2c0a353aef41a6df2de8e1fe3eaa3d8bbd8a6dd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Valim?= Date: Fri, 12 Mar 2010 20:39:53 +0100 Subject: Finish cleaning up rendering stack from views and move assigns evaluation to controller (so plugins and/or controllers can overwrite just one method). --- actionpack/lib/abstract_controller/rendering.rb | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'actionpack/lib/abstract_controller/rendering.rb') diff --git a/actionpack/lib/abstract_controller/rendering.rb b/actionpack/lib/abstract_controller/rendering.rb index 42f4939108..16664098e5 100644 --- a/actionpack/lib/abstract_controller/rendering.rb +++ b/actionpack/lib/abstract_controller/rendering.rb @@ -31,6 +31,8 @@ module AbstractController module Rendering extend ActiveSupport::Concern + + include AbstractController::Assigns include AbstractController::ViewPaths # Overwrite process to setup I18n proxy. @@ -54,8 +56,8 @@ module AbstractController @_view_context ||= ActionView::Base.for_controller(self) end - # Mostly abstracts the fact that calling render twice is a DoubleRenderError. - # Delegates render_to_body and sticks the result in self.response_body. + # Normalize arguments, options and then delegates render_to_body and + # sticks the result in self.response_body. def render(*args, &block) options = _normalize_args(*args, &block) _normalize_options(options) @@ -78,8 +80,10 @@ module AbstractController end # Find and renders a template based on the options given. - def _render_template(options) - view_context.render_template(options) { |template| _with_template_hook(template) } + # :api: private + def _render_template(options) #:nodoc: + _evaluate_assigns(view_context) + view_context.render(options) end # The prefix used in render "foo" shortcuts. @@ -134,9 +138,5 @@ module AbstractController def _process_options(options) end - - def _with_template_hook(template) - self.formats = template.formats - end end end -- cgit v1.2.3