aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/lib/action_view
diff options
context:
space:
mode:
authorRick Olson <technoweenie@gmail.com>2007-02-05 05:39:23 +0000
committerRick Olson <technoweenie@gmail.com>2007-02-05 05:39:23 +0000
commit2782c37bdfbe22fcbc1feea7603bb2413beb6f22 (patch)
tree273b3a2199b58ebfc88245b523133b187f6b5fa9 /actionpack/lib/action_view
parent38e5d21bc4078a73bf3f90e54e8df046f92e15b3 (diff)
downloadrails-2782c37bdfbe22fcbc1feea7603bb2413beb6f22.tar.gz
rails-2782c37bdfbe22fcbc1feea7603bb2413beb6f22.tar.bz2
rails-2782c37bdfbe22fcbc1feea7603bb2413beb6f22.zip
Fix #render_file so that TemplateError is called with the correct params and you don't get the WSOD. [Rick]
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@6130 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'actionpack/lib/action_view')
-rw-r--r--actionpack/lib/action_view/base.rb9
1 files changed, 4 insertions, 5 deletions
diff --git a/actionpack/lib/action_view/base.rb b/actionpack/lib/action_view/base.rb
index d8bb6add34..4ef36a8812 100644
--- a/actionpack/lib/action_view/base.rb
+++ b/actionpack/lib/action_view/base.rb
@@ -245,10 +245,9 @@ module ActionView #:nodoc:
# is made available as local variables.
def render_file(template_path, use_full_path = true, local_assigns = {}) #:nodoc:
@first_render ||= template_path
-
+ template_path_without_extension, template_extension = path_and_extension(template_path)
+
if use_full_path
- template_path_without_extension, template_extension = path_and_extension(template_path)
-
if template_extension
template_file_name = full_template_path(template_path_without_extension, template_extension)
else
@@ -257,7 +256,6 @@ module ActionView #:nodoc:
end
else
template_file_name = template_path
- template_extension = template_path.split('.').last
end
template_source = nil # Don't read the source until we know that it is required
@@ -269,7 +267,7 @@ module ActionView #:nodoc:
e.sub_template_of(template_file_name)
raise e
else
- raise TemplateError.new(find_base_path_for(template_file_name), template_file_name, @assigns, template_source, e)
+ raise TemplateError.new(find_base_path_for("#{template_path_without_extension}.#{template_extension}"), template_file_name, @assigns, template_source, e)
end
end
end
@@ -395,6 +393,7 @@ module ActionView #:nodoc:
@@cache_template_extensions && @@cached_template_extension[template_path]
end
+ # 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)) }
end