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
This commit is contained in:
Jeremy Kemper 2006-12-08 22:19:00 +00:00
parent 906bd93f4f
commit a454dcf012
3 changed files with 5 additions and 1 deletions

@ -1,5 +1,7 @@
*SVN* *SVN*
* Unrescued ActiveRecord::RecordNotFound responds with 404 instead of 500. [Jeremy Kemper]
* Improved auto_link to match more valid urls correctly [Tobias Luetke] * Improved auto_link to match more valid urls correctly [Tobias Luetke]
* Add singleton resources. [Rick Olson] * Add singleton resources. [Rick Olson]

@ -11,7 +11,8 @@ module Rescue
DEFAULT_RESCUE_RESPONSE = :internal_server_error DEFAULT_RESCUE_RESPONSE = :internal_server_error
DEFAULT_RESCUE_RESPONSES = { DEFAULT_RESCUE_RESPONSES = {
'ActionController::RoutingError' => :not_found, 'ActionController::RoutingError' => :not_found,
'ActionController::UnknownAction' => :not_found 'ActionController::UnknownAction' => :not_found,
'ActiveRecord::RecordNotFound' => :not_found
} }
DEFAULT_RESCUE_TEMPLATE = 'diagnostics' DEFAULT_RESCUE_TEMPLATE = 'diagnostics'

@ -143,6 +143,7 @@ def test_rescue_responses
assert_equal :not_found, responses[ActionController::RoutingError.name] assert_equal :not_found, responses[ActionController::RoutingError.name]
assert_equal :not_found, responses[ActionController::UnknownAction.name] assert_equal :not_found, responses[ActionController::UnknownAction.name]
assert_equal :not_found, responses['ActiveRecord::RecordNotFound']
end end
def test_rescue_templates def test_rescue_templates