aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/CHANGELOG.md
diff options
context:
space:
mode:
authorSameer Rahmani <lxsameer@gnu.org>2015-07-21 18:49:09 +0430
committerSameer Rahmani <lxsameer@gnu.org>2015-07-21 19:19:14 +0430
commitd763956ed95bce581f12151a5ed4df12bcefdeee (patch)
treed79749c8598debbba48a6f6d81442f60157c7361 /activerecord/CHANGELOG.md
parent36ea89a80c502067bf513b6d16a547411511fae8 (diff)
downloadrails-d763956ed95bce581f12151a5ed4df12bcefdeee.tar.gz
rails-d763956ed95bce581f12151a5ed4df12bcefdeee.tar.bz2
rails-d763956ed95bce581f12151a5ed4df12bcefdeee.zip
Extra caller details added to ActiveRecord::RecordNotFound
ActiveRecord::RecordNotFound modified to store model name, primary_key and id of the caller model. It allows the catcher of this exception to make a better decision to what to do with it. For example consider this simple example: class SomeAbstractController < ActionController::Base rescue_from ActiveRecord::RecordNotFound, with: :redirect_to_404 private def redirect_to_404(e) return redirect_to(posts_url) if e.model == 'Post' raise end end
Diffstat (limited to 'activerecord/CHANGELOG.md')
-rw-r--r--activerecord/CHANGELOG.md16
1 files changed, 16 insertions, 0 deletions
diff --git a/activerecord/CHANGELOG.md b/activerecord/CHANGELOG.md
index 22f805fea4..fb64156b78 100644
--- a/activerecord/CHANGELOG.md
+++ b/activerecord/CHANGELOG.md
@@ -1,3 +1,19 @@
+* ActiveRecord::RecordNotFound modified to store model name, primary_key and
+ id of the caller model. It allows the catcher of this exception to make
+ a better decision to what to do with it. For example consider this simple
+ example:
+
+ class SomeAbstractController < ActionController::Base
+ rescue_from ActiveRecord::RecordNotFound, with: :redirect_to_404
+
+ private def redirect_to_404(e)
+ return redirect_to(posts_url) if e.model == 'Post'
+ raise
+ end
+ end
+
+ *Sameer Rahmani*
+
* Deprecate the keys for association `restrict_dependent_destroy` errors in favor
of new key names.