aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRick Olson <technoweenie@gmail.com>2007-04-08 02:32:25 +0000
committerRick Olson <technoweenie@gmail.com>2007-04-08 02:32:25 +0000
commit142b074e9123f477ea8f93898690fc462fdcbf90 (patch)
treee399b8ad3353685e59ed10bd70a6d3d8efa2f881
parentda6f5a1cb4ccabef8c5ae0cb56495c198844c4f8 (diff)
downloadrails-142b074e9123f477ea8f93898690fc462fdcbf90.tar.gz
rails-142b074e9123f477ea8f93898690fc462fdcbf90.tar.bz2
rails-142b074e9123f477ea8f93898690fc462fdcbf90.zip
Fix WSOD when template compilation fails [Rick]
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@6505 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
-rw-r--r--actionpack/CHANGELOG2
-rw-r--r--actionpack/lib/action_view/base.rb7
2 files changed, 8 insertions, 1 deletions
diff --git a/actionpack/CHANGELOG b/actionpack/CHANGELOG
index bd60b3e265..f14748e03b 100644
--- a/actionpack/CHANGELOG
+++ b/actionpack/CHANGELOG
@@ -1,5 +1,7 @@
*SVN*
+* Fix WSOD when template compilation fails [Rick]
+
* Change ActionView template defaults. Look for templates using the request format first, such as "show.html.erb" or "show.xml.builder", before looking for the old defaults like "show.erb" or "show.builder" [Rick]
* Highlight helper highlights one or many terms in a single pass. [Jeremy Kemper]
diff --git a/actionpack/lib/action_view/base.rb b/actionpack/lib/action_view/base.rb
index f23cb16245..4cca763d35 100644
--- a/actionpack/lib/action_view/base.rb
+++ b/actionpack/lib/action_view/base.rb
@@ -428,6 +428,11 @@ module ActionView #:nodoc:
@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 }
+ end
+
# Determines the template's file extension, such as rhtml, rxml, or rjs.
def find_template_extension_for(template_path, formatted_template_path = nil)
formatted_template_path ||= "#{template_path}.#{template_format}"
@@ -577,7 +582,7 @@ module ActionView #:nodoc:
logger.debug "Backtrace: #{e.backtrace.join("\n")}"
end
- raise TemplateError.new(find_base_path_for(file_name || template), file_name || template, @assigns, template, e)
+ raise TemplateError.new(extract_base_path_from(file_name) || @view_paths.first, file_name || template, @assigns, template, e)
end
@@compile_time[render_symbol] = Time.now