diff options
-rw-r--r-- | actionpack/CHANGELOG | 2 | ||||
-rw-r--r-- | actionpack/lib/action_controller/rescue.rb | 3 | ||||
-rw-r--r-- | actionpack/test/controller/rescue_test.rb | 1 |
3 files changed, 5 insertions, 1 deletions
diff --git a/actionpack/CHANGELOG b/actionpack/CHANGELOG index 807876f1ce..199999bfe5 100644 --- a/actionpack/CHANGELOG +++ b/actionpack/CHANGELOG @@ -1,5 +1,7 @@ *SVN* +* Use 400 Bad Request status for unrescued ActiveRecord::RecordInvalid exceptions. [Jeremy Kemper] + * Silence log_error deprecation warnings from inspecting deprecated instance variables. [Nate Wiger] * Only cache GET requests with a 200 OK response. #6514, #6743 [RSL, anamba] diff --git a/actionpack/lib/action_controller/rescue.rb b/actionpack/lib/action_controller/rescue.rb index 035047085d..e0107c5050 100644 --- a/actionpack/lib/action_controller/rescue.rb +++ b/actionpack/lib/action_controller/rescue.rb @@ -12,7 +12,8 @@ module ActionController #:nodoc: DEFAULT_RESCUE_RESPONSES = { 'ActionController::RoutingError' => :not_found, 'ActionController::UnknownAction' => :not_found, - 'ActiveRecord::RecordNotFound' => :not_found + 'ActiveRecord::RecordNotFound' => :not_found, + 'ActiveRecord::RecordInvalid' => :bad_request } DEFAULT_RESCUE_TEMPLATE = 'diagnostics' diff --git a/actionpack/test/controller/rescue_test.rb b/actionpack/test/controller/rescue_test.rb index c18de75c05..91532ee0c2 100644 --- a/actionpack/test/controller/rescue_test.rb +++ b/actionpack/test/controller/rescue_test.rb @@ -144,6 +144,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'] + assert_equal :bad_request, responses['ActiveRecord::RecordInvalid'] end def test_rescue_templates |