aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack
diff options
context:
space:
mode:
Diffstat (limited to 'actionpack')
-rw-r--r--actionpack/CHANGELOG2
-rwxr-xr-xactionpack/lib/action_controller/base.rb5
-rw-r--r--actionpack/test/controller/rescue_test.rb14
3 files changed, 19 insertions, 2 deletions
diff --git a/actionpack/CHANGELOG b/actionpack/CHANGELOG
index 88832a6f2a..885f318d5d 100644
--- a/actionpack/CHANGELOG
+++ b/actionpack/CHANGELOG
@@ -1,5 +1,7 @@
*SVN*
+* Make sure missing template exceptions actually say which template they were looking for. Closes #8683 [dasil003]
+
* Fix errors with around_filters which do not yield, restore 1.1 behaviour with after filters. Closes #8891 [skaes]
After filters will *no longer* be run if an around_filter fails to yield, users relying on
diff --git a/actionpack/lib/action_controller/base.rb b/actionpack/lib/action_controller/base.rb
index d3aff6a2c2..da948940af 100755
--- a/actionpack/lib/action_controller/base.rb
+++ b/actionpack/lib/action_controller/base.rb
@@ -1241,9 +1241,10 @@ module ActionController #:nodoc:
def assert_existence_of_template_file(template_name)
unless template_exists?(template_name) || ignore_missing_templates
- full_template_path = template_name.include?('.') ? template_name : @template.full_template_path(template_name, "#{@template.template_format}.erb")
+ full_template_path = template_name.include?('.') ? template_name : "#{template_name}.#{@template.template_format}.erb"
+ display_paths = view_paths.join(':')
template_type = (template_name =~ /layouts/i) ? 'layout' : 'template'
- raise(MissingTemplate, "Missing #{template_type} #{full_template_path}")
+ raise(MissingTemplate, "Missing #{template_type} #{full_template_path} in view path #{display_paths}")
end
end
diff --git a/actionpack/test/controller/rescue_test.rb b/actionpack/test/controller/rescue_test.rb
index 100fee8a6e..6756e226c3 100644
--- a/actionpack/test/controller/rescue_test.rb
+++ b/actionpack/test/controller/rescue_test.rb
@@ -15,6 +15,8 @@ class RescueController < ActionController::Base
def not_implemented
raise ActionController::NotImplemented.new(:get, :put)
end
+
+ def missing_template; end
end
@@ -116,6 +118,18 @@ class RescueTest < Test::Unit::TestCase
end
+ def test_rescue_missing_template_in_public
+ with_rails_root FIXTURE_PUBLIC do
+ with_all_requests_local true do
+ get :missing_template
+ end
+ end
+
+ assert_response :internal_server_error
+ assert @response.body.include?('missing_template'), "Response should include the template name."
+ end
+
+
def test_rescue_action_locally
get :raises
assert_response :internal_server_error