aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib
diff options
context:
space:
mode:
authorSean Griffin <sean@thoughtbot.com>2014-12-22 15:38:58 -0700
committerSean Griffin <sean@thoughtbot.com>2014-12-22 15:38:58 -0700
commitfb160f6e7d71ece0369c6ba9a011ed060f2dcbcb (patch)
tree4a2adbd6be71ea374d7832fd22b5b63c6dfb31bd /activerecord/lib
parent18ae0656f527e790bdc827fe68e3f2edd541b3a4 (diff)
downloadrails-fb160f6e7d71ece0369c6ba9a011ed060f2dcbcb.tar.gz
rails-fb160f6e7d71ece0369c6ba9a011ed060f2dcbcb.tar.bz2
rails-fb160f6e7d71ece0369c6ba9a011ed060f2dcbcb.zip
Don't perform statement caching for `find` when called from a scope
If there is a method defined such as `find_and_do_stuff(id)`, which then gets called on an association, we will perform statement caching and the parent ID will not change on subsequent calls. Fixes #18117
Diffstat (limited to 'activerecord/lib')
-rw-r--r--activerecord/lib/active_record/core.rb1
1 files changed, 1 insertions, 0 deletions
diff --git a/activerecord/lib/active_record/core.rb b/activerecord/lib/active_record/core.rb
index c2d5582f02..94d1e07069 100644
--- a/activerecord/lib/active_record/core.rb
+++ b/activerecord/lib/active_record/core.rb
@@ -131,6 +131,7 @@ module ActiveRecord
return super if block_given? ||
primary_key.nil? ||
default_scopes.any? ||
+ current_scope ||
columns_hash.include?(inheritance_column) ||
ids.first.kind_of?(Array)