From 7f517348db260fb0794a3644f761ac91fe540472 Mon Sep 17 00:00:00 2001 From: Rick Olson Date: Fri, 15 Jun 2007 23:52:37 +0000 Subject: Make ActionView#view_paths an attr_accessor for real this time. Also, don't perform an unnecessary #compact on the @view_paths array in #initialize. Closes #8582 [dasil003, julik, rick] git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@7034 5ecf4fe2-1ee6-0310-87b1-e25e094e27de --- actionpack/lib/action_view/base.rb | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'actionpack/lib/action_view/base.rb') diff --git a/actionpack/lib/action_view/base.rb b/actionpack/lib/action_view/base.rb index 61d4bd7ad2..63ec0021b0 100644 --- a/actionpack/lib/action_view/base.rb +++ b/actionpack/lib/action_view/base.rb @@ -154,9 +154,9 @@ module ActionView #:nodoc: attr_reader :first_render attr_accessor :base_path, :assigns, :template_extension - attr_accessor :controller + attr_accessor :controller, :view_paths - attr_reader :logger, :response, :headers, :view_paths + attr_reader :logger, :response, :headers attr_internal :cookies, :flash, :headers, :params, :request, :response, :session attr_writer :template_format @@ -248,7 +248,7 @@ module ActionView #:nodoc: end def initialize(view_paths = [], assigns_for_first_render = {}, controller = nil)#:nodoc: - @view_paths = [*view_paths].compact + @view_paths = view_paths.respond_to?(:find) ? view_paths : [*view_paths].compact @assigns = assigns_for_first_render @assigns_added = nil @controller = controller @@ -267,7 +267,7 @@ module ActionView #:nodoc: else template_extension = pick_template_extension(template_path).to_s unless template_extension - raise ActionViewError, "No #{template_handler_preferences.to_sentence} template found for #{template_path} in #{@view_paths.inspect}" + raise ActionViewError, "No #{template_handler_preferences.to_sentence} template found for #{template_path} in #{view_paths.inspect}" end template_file_name = full_template_path(template_path, template_extension) template_extension = template_extension.gsub(/^\w+\./, '') # strip off any formats @@ -279,7 +279,7 @@ module ActionView #:nodoc: template_source = nil # Don't read the source until we know that it is required if template_file_name.blank? - raise ActionViewError, "Couldn't find template file for #{template_path} in #{@view_paths.inspect}" + raise ActionViewError, "Couldn't find template file for #{template_path} in #{view_paths.inspect}" end begin @@ -453,12 +453,12 @@ module ActionView #:nodoc: # Returns the view path that contains the given relative template path. def find_base_path_for(template_file_name) - @view_paths.find { |p| File.file?(File.join(p, template_file_name)) } + view_paths.find { |p| File.file?(File.join(p, template_file_name)) } end # Returns the view path that the full path resides in. def extract_base_path_from(full_path) - @view_paths.find { |p| full_path[0..p.size - 1] == p } + view_paths.find { |p| full_path[0..p.size - 1] == p } end # Determines the template's file extension, such as rhtml, rxml, or rjs. -- cgit v1.2.3