aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack
diff options
context:
space:
mode:
Diffstat (limited to 'actionpack')
-rw-r--r--actionpack/CHANGELOG2
-rw-r--r--actionpack/lib/action_view/base.rb4
-rw-r--r--actionpack/test/controller/new_render_test.rb10
3 files changed, 16 insertions, 0 deletions
diff --git a/actionpack/CHANGELOG b/actionpack/CHANGELOG
index 1aa2d5b521..cba7c56d38 100644
--- a/actionpack/CHANGELOG
+++ b/actionpack/CHANGELOG
@@ -1,5 +1,7 @@
*SVN*
+* catch possible WSOD when trying to render a missing partial. Closes #8454 [Catfish]
+
* Rewind request body after reading it, if possible. #8438 [s450r1]
* Resource namespaces are inherited by their has_many subresources. #8280 [marclove, ggarside]
diff --git a/actionpack/lib/action_view/base.rb b/actionpack/lib/action_view/base.rb
index 69db2772bb..f6885fa292 100644
--- a/actionpack/lib/action_view/base.rb
+++ b/actionpack/lib/action_view/base.rb
@@ -278,6 +278,10 @@ 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}"
+ end
+
begin
render_template(template_extension, template_source, template_file_name, local_assigns)
rescue Exception => e
diff --git a/actionpack/test/controller/new_render_test.rb b/actionpack/test/controller/new_render_test.rb
index 3fade1c7b8..4f2b062fa2 100644
--- a/actionpack/test/controller/new_render_test.rb
+++ b/actionpack/test/controller/new_render_test.rb
@@ -163,6 +163,10 @@ class NewRenderTestController < ActionController::Base
render :partial => "customer"
end
+ def missing_partial
+ render :partial => 'thisFileIsntHere'
+ end
+
def hello_in_a_string
@customers = [ Customer.new("david"), Customer.new("mary") ]
render :text => "How's there? #{render_to_string("test/list")}"
@@ -682,6 +686,12 @@ EOS
assert_equal "Hello: Marcel", @response.body
end
+ def test_render_missing_partial_template
+ assert_raises(ActionView::ActionViewError) do
+ get :missing_partial
+ end
+ end
+
def test_render_text_with_assigns
get :render_text_with_assigns
assert_equal "world", assigns["hello"]