aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack
diff options
context:
space:
mode:
authorJeremy Kemper <jeremy@bitsweat.net>2006-12-08 22:19:00 +0000
committerJeremy Kemper <jeremy@bitsweat.net>2006-12-08 22:19:00 +0000
commita454dcf012e13f24c6c74098f9fd4efd72e8aadc (patch)
tree00664b888dd1ef988abc81877a01d7a69e7cb1d6 /actionpack
parent906bd93f4fdbad429cca8a0cfa7f32ec1eb7960a (diff)
downloadrails-a454dcf012e13f24c6c74098f9fd4efd72e8aadc.tar.gz
rails-a454dcf012e13f24c6c74098f9fd4efd72e8aadc.tar.bz2
rails-a454dcf012e13f24c6c74098f9fd4efd72e8aadc.zip
Unrescued ActiveRecord::RecordNotFound responds with 404 instead of 500.
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@5706 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'actionpack')
-rw-r--r--actionpack/CHANGELOG2
-rw-r--r--actionpack/lib/action_controller/rescue.rb3
-rw-r--r--actionpack/test/controller/rescue_test.rb1
3 files changed, 5 insertions, 1 deletions
diff --git a/actionpack/CHANGELOG b/actionpack/CHANGELOG
index d9ba19526b..8ffbe8f88a 100644
--- a/actionpack/CHANGELOG
+++ b/actionpack/CHANGELOG
@@ -1,5 +1,7 @@
*SVN*
+* Unrescued ActiveRecord::RecordNotFound responds with 404 instead of 500. [Jeremy Kemper]
+
* Improved auto_link to match more valid urls correctly [Tobias Luetke]
* Add singleton resources. [Rick Olson]
diff --git a/actionpack/lib/action_controller/rescue.rb b/actionpack/lib/action_controller/rescue.rb
index 08ee699f7f..01969e867c 100644
--- a/actionpack/lib/action_controller/rescue.rb
+++ b/actionpack/lib/action_controller/rescue.rb
@@ -11,7 +11,8 @@ module ActionController #:nodoc:
DEFAULT_RESCUE_RESPONSE = :internal_server_error
DEFAULT_RESCUE_RESPONSES = {
'ActionController::RoutingError' => :not_found,
- 'ActionController::UnknownAction' => :not_found
+ 'ActionController::UnknownAction' => :not_found,
+ 'ActiveRecord::RecordNotFound' => :not_found
}
DEFAULT_RESCUE_TEMPLATE = 'diagnostics'
diff --git a/actionpack/test/controller/rescue_test.rb b/actionpack/test/controller/rescue_test.rb
index c49575cad3..c18de75c05 100644
--- a/actionpack/test/controller/rescue_test.rb
+++ b/actionpack/test/controller/rescue_test.rb
@@ -143,6 +143,7 @@ class RescueTest < Test::Unit::TestCase
assert_equal :not_found, responses[ActionController::RoutingError.name]
assert_equal :not_found, responses[ActionController::UnknownAction.name]
+ assert_equal :not_found, responses['ActiveRecord::RecordNotFound']
end
def test_rescue_templates