From a04f0228776e7616c372f867a1212b5798cde80a Mon Sep 17 00:00:00 2001 From: Pratik Naik Date: Mon, 21 Apr 2008 11:39:46 +0100 Subject: Delegate ivars to controller instead of copying Reduce number of instance variables being copied from controller to view. Instead, delegate them to controller instance. --- actionpack/lib/action_controller/base.rb | 3 ++- actionpack/lib/action_view/base.rb | 9 ++++----- 2 files changed, 6 insertions(+), 6 deletions(-) (limited to 'actionpack/lib') diff --git a/actionpack/lib/action_controller/base.rb b/actionpack/lib/action_controller/base.rb index 1aa027f9d7..0c0d0ec4ac 100755 --- a/actionpack/lib/action_controller/base.rb +++ b/actionpack/lib/action_controller/base.rb @@ -256,7 +256,8 @@ module ActionController #:nodoc: # Controller specific instance variables which will not be accessible inside views. @@protected_view_variables = %w(@assigns @performed_redirect @performed_render @variables_added @request_origin @url @parent_controller - @action_name @before_filter_chain_aborted @action_cache_path) + @action_name @before_filter_chain_aborted @action_cache_path @_session @_cookies @_headers @_params + @_flash @_response) # Prepends all the URL-generating helpers from AssetHelper. This makes it possible to easily move javascripts, stylesheets, # and images to a dedicated asset server away from the main web server. Example: diff --git a/actionpack/lib/action_view/base.rb b/actionpack/lib/action_view/base.rb index 12dd7d2bc9..4ed20fec89 100644 --- a/actionpack/lib/action_view/base.rb +++ b/actionpack/lib/action_view/base.rb @@ -156,9 +156,6 @@ module ActionView #:nodoc: attr_reader :finder attr_accessor :base_path, :assigns, :template_extension, :first_render attr_accessor :controller - - attr_reader :logger, :response, :headers - attr_internal :cookies, :flash, :headers, :params, :request, :response, :session attr_writer :template_format attr_accessor :current_render_extension @@ -185,7 +182,10 @@ module ActionView #:nodoc: @@erb_variable = '_erbout' cattr_accessor :erb_variable - delegate :request_forgery_protection_token, :to => :controller + attr_internal :request + + delegate :request_forgery_protection_token, :template, :params, :session, :cookies, :response, :headers, + :flash, :logger, :to => :controller module CompiledTemplates #:nodoc: # holds compiled template code @@ -222,7 +222,6 @@ module ActionView #:nodoc: @assigns = assigns_for_first_render @assigns_added = nil @controller = controller - @logger = controller && controller.logger @finder = TemplateFinder.new(self, view_paths) end -- cgit v1.2.3