diff options
author | José Valim <jose.valim@gmail.com> | 2011-12-01 21:18:47 +0100 |
---|---|---|
committer | José Valim <jose.valim@gmail.com> | 2011-12-01 21:18:47 +0100 |
commit | 07f90f6bec702a6e08d65a33682ddd244050375f (patch) | |
tree | eb76e17734ae44e08a75b8d74740e6e600422ae6 /activerecord | |
parent | 83d29a283ceb13ff431da535e8cc35db6828016c (diff) | |
parent | 6a4606d3a64e60189ea4ba5243830dcd97e6de14 (diff) | |
download | rails-07f90f6bec702a6e08d65a33682ddd244050375f.tar.gz rails-07f90f6bec702a6e08d65a33682ddd244050375f.tar.bz2 rails-07f90f6bec702a6e08d65a33682ddd244050375f.zip |
Merge branch 'exceptions' with the following features:
* A Railtie API for registering new exceptions and their respective status code (check Active Record railtie for an example)
* Extraction of ShowExceptions middleware logging and debugging features into a middleware called DebugExceptions
Conflicts:
actionpack/CHANGELOG.md
Diffstat (limited to 'activerecord')
-rw-r--r-- | activerecord/lib/active_record/railtie.rb | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/activerecord/lib/active_record/railtie.rb b/activerecord/lib/active_record/railtie.rb index 47133e77e8..c2e31579a4 100644 --- a/activerecord/lib/active_record/railtie.rb +++ b/activerecord/lib/active_record/railtie.rb @@ -22,6 +22,13 @@ module ActiveRecord config.app_middleware.insert_after "::ActionDispatch::Callbacks", "ActiveRecord::ConnectionAdapters::ConnectionManagement" + config.action_dispatch.rescue_responses.merge!( + 'ActiveRecord::RecordNotFound' => :not_found, + 'ActiveRecord::StaleObjectError' => :conflict, + 'ActiveRecord::RecordInvalid' => :unprocessable_entity, + 'ActiveRecord::RecordNotSaved' => :unprocessable_entity + ) + rake_tasks do load "active_record/railties/databases.rake" end |