aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJeremy Kemper <jeremy@bitsweat.net>2007-01-17 00:43:53 +0000
committerJeremy Kemper <jeremy@bitsweat.net>2007-01-17 00:43:53 +0000
commitd38417fc02bc12f1182c0821eda6b58ef3b8ca5a (patch)
treed0977d6d00a00790412c699467b841d33473def1
parentb0a1aa7e7e4bc1b0a714fd143cc91944e2f4d230 (diff)
downloadrails-d38417fc02bc12f1182c0821eda6b58ef3b8ca5a.tar.gz
rails-d38417fc02bc12f1182c0821eda6b58ef3b8ca5a.tar.bz2
rails-d38417fc02bc12f1182c0821eda6b58ef3b8ca5a.zip
RecordInvalid, RecordNotSaved => 422 Unprocessable Entity, StaleObjectError => 409 Conflict. References #7097.
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@5966 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
-rw-r--r--actionpack/CHANGELOG2
-rw-r--r--actionpack/lib/action_controller/rescue.rb4
-rw-r--r--actionpack/test/controller/rescue_test.rb4
3 files changed, 8 insertions, 2 deletions
diff --git a/actionpack/CHANGELOG b/actionpack/CHANGELOG
index c3cfcc0ab6..23acae90bf 100644
--- a/actionpack/CHANGELOG
+++ b/actionpack/CHANGELOG
@@ -1,5 +1,7 @@
*SVN*
+* RecordInvalid, RecordNotSaved => 422 Unprocessable Entity, StaleObjectError => 409 Conflict. #7097 [dkubb]
+
* Allow fields_for to be nested inside form_for, so that the name and id get properly constructed [Jamis Buck]
* Allow inGroupsOf and eachSlice to be called through rjs. #7046 [Cody Fauser]
diff --git a/actionpack/lib/action_controller/rescue.rb b/actionpack/lib/action_controller/rescue.rb
index ca85ef34d0..9f94e076c7 100644
--- a/actionpack/lib/action_controller/rescue.rb
+++ b/actionpack/lib/action_controller/rescue.rb
@@ -16,7 +16,9 @@ module ActionController #:nodoc:
'ActionController::RoutingError' => :not_found,
'ActionController::UnknownAction' => :not_found,
'ActiveRecord::RecordNotFound' => :not_found,
- 'ActiveRecord::RecordInvalid' => :bad_request
+ 'ActiveRecord::StaleObjectError' => :conflict,
+ 'ActiveRecord::RecordInvalid' => :unprocessable_entity,
+ 'ActiveRecord::RecordNotSaved' => :unprocessable_entity
}
DEFAULT_RESCUE_TEMPLATE = 'diagnostics'
diff --git a/actionpack/test/controller/rescue_test.rb b/actionpack/test/controller/rescue_test.rb
index aa4d851e8e..f539546a1a 100644
--- a/actionpack/test/controller/rescue_test.rb
+++ b/actionpack/test/controller/rescue_test.rb
@@ -141,7 +141,9 @@ 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']
+ assert_equal :conflict, responses['ActiveRecord::StaleObjectError']
+ assert_equal :unprocessable_entity, responses['ActiveRecord::RecordInvalid']
+ assert_equal :unprocessable_entity, responses['ActiveRecord::RecordNotSaved']
end
def test_rescue_templates