From a5d80f84d269bba6b0f0802612f29df1ee09d720 Mon Sep 17 00:00:00 2001 From: Carlhuda Date: Thu, 18 Mar 2010 18:12:04 -0700 Subject: Each controller class has it's own view context subclass. This removes the need for ActionView::Base.for_controller --- actionpack/lib/action_view/base.rb | 32 -------------------------------- actionpack/lib/action_view/context.rb | 2 -- 2 files changed, 34 deletions(-) (limited to 'actionpack/lib/action_view') diff --git a/actionpack/lib/action_view/base.rb b/actionpack/lib/action_view/base.rb index b82c6a8203..66af693cde 100644 --- a/actionpack/lib/action_view/base.rb +++ b/actionpack/lib/action_view/base.rb @@ -220,38 +220,6 @@ module ActionView #:nodoc: ActionView::PathSet.new(Array.wrap(value)) end - def self.for_controller(controller) - @views ||= {} - - # TODO: Decouple this so helpers are a separate concern in AV just like - # they are in AC. - if controller.class.respond_to?(:_helper_serial) - klass = @views[controller.class._helper_serial] ||= Class.new(self) do - # Try to make stack traces clearer - class_eval <<-ruby_eval, __FILE__, __LINE__ + 1 - def self.name - "ActionView for #{controller.class}" - end - - def inspect - "#<#{self.class.name}>" - end - ruby_eval - - if controller.respond_to?(:_helpers) - include controller._helpers - self.helpers = controller._helpers - end - - if controller.respond_to?(:_router) - include controller._router.url_helpers - end - end - else - klass = self - end - end - def initialize(lookup_context = nil, assigns_for_first_render = {}, controller = nil, formats = nil) #:nodoc: @config = nil @assigns = assigns_for_first_render.each { |key, value| instance_variable_set("@#{key}", value) } diff --git a/actionpack/lib/action_view/context.rb b/actionpack/lib/action_view/context.rb index df078a7151..61d2e702a7 100644 --- a/actionpack/lib/action_view/context.rb +++ b/actionpack/lib/action_view/context.rb @@ -10,8 +10,6 @@ module ActionView # In order to work with ActionController, a Context # must implement: # - # Context.for_controller[controller] Create a new ActionView instance for a - # controller # Context#render_partial[options] # - responsible for setting options[:_template] # - Returns String with the rendered partial -- cgit v1.2.3