From bb530923bcd5c643f9bfca8e36cd3fa36365032d Mon Sep 17 00:00:00 2001 From: Yehuda Katz Date: Sun, 19 Jul 2009 21:53:02 +0900 Subject: Simplify required "ActionView compliant" API --- actionpack/lib/action_controller/abstract/helpers.rb | 6 ------ actionpack/lib/action_controller/abstract/renderer.rb | 19 ++++++++----------- 2 files changed, 8 insertions(+), 17 deletions(-) (limited to 'actionpack/lib/action_controller/abstract') diff --git a/actionpack/lib/action_controller/abstract/helpers.rb b/actionpack/lib/action_controller/abstract/helpers.rb index 6b73f887c1..5efa37fde3 100644 --- a/actionpack/lib/action_controller/abstract/helpers.rb +++ b/actionpack/lib/action_controller/abstract/helpers.rb @@ -8,12 +8,6 @@ module AbstractController extlib_inheritable_accessor(:_helpers) { Module.new } end - # Override AbstractController::Renderer's _action_view to include the - # helper module for this class into its helpers module. - def _action_view - @_action_view ||= super.tap { |av| av.helpers.include(_helpers) } - end - module ClassMethods # When a class is inherited, wrap its helper module in a new module. # This ensures that the parent class's module can be changed diff --git a/actionpack/lib/action_controller/abstract/renderer.rb b/actionpack/lib/action_controller/abstract/renderer.rb index 611d3a16ce..41b7d47458 100644 --- a/actionpack/lib/action_controller/abstract/renderer.rb +++ b/actionpack/lib/action_controller/abstract/renderer.rb @@ -17,25 +17,22 @@ module AbstractController # An instance of a view class. The default view class is ActionView::Base # # The view class must have the following methods: - # initialize[paths, assigns_for_first_render, controller] - # paths:: A list of resolvers to look for templates in - # controller A controller - # _render_partial_from_controller[options] + # View.for_controller[controller] Create a new ActionView instance for a + # controller + # View#_render_partial_from_controller[options] + # - responsible for setting options[:_template] + # - Returns String with the rendered partial # options:: see _render_partial in ActionView::Base - # _render_template_from_controller[template, layout, options, partial] + # View#_render_template_from_controller[template, layout, options, partial] + # - Returns String with the rendered template # template:: The template to render # layout:: The layout to render around the template # options:: See _render_template_with_layout in ActionView::Base # partial:: Whether or not the template to render is a partial - # _partial:: If a partial, rather than a template, was rendered, return - # the partial. - # helpers:: A module containing the helpers to be used in the view. This - # module should respond_to include. - # controller:: The controller that initialized the ActionView # # Override this method in a to change the default behavior. def _action_view - @_action_view ||= ActionView::Base.new(self.class.view_paths, {}, self) + @_action_view ||= ActionView::Base.for_controller(self) end # Mostly abstracts the fact that calling render twice is a DoubleRenderError. -- cgit v1.2.3