aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/lib/action_view/base.rb
diff options
context:
space:
mode:
authorRick Olson <technoweenie@gmail.com>2007-06-15 23:52:37 +0000
committerRick Olson <technoweenie@gmail.com>2007-06-15 23:52:37 +0000
commit7f517348db260fb0794a3644f761ac91fe540472 (patch)
treece43b8e4da29effdabb8d10578bdef72022a80ce /actionpack/lib/action_view/base.rb
parent9d4225f1298bebacc04cc0055b180c6b2926c024 (diff)
downloadrails-7f517348db260fb0794a3644f761ac91fe540472.tar.gz
rails-7f517348db260fb0794a3644f761ac91fe540472.tar.bz2
rails-7f517348db260fb0794a3644f761ac91fe540472.zip
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
Diffstat (limited to 'actionpack/lib/action_view/base.rb')
-rw-r--r--actionpack/lib/action_view/base.rb14
1 files changed, 7 insertions, 7 deletions
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.