aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib/active_record/core.rb
diff options
context:
space:
mode:
authorakihiro17 <coolwizard11@gmail.com>2015-07-21 01:31:48 +0900
committerakihiro17 <coolwizard11@gmail.com>2015-10-06 02:36:46 +0900
commitf798cbd2f36ed8a4b825667016d6975b812a5b9f (patch)
treec044f405c82d7386fc5ea2bf6c55aa564ec0984f /activerecord/lib/active_record/core.rb
parentdf9faf53e9cfddd1be9a09811eed1192a3073afc (diff)
downloadrails-f798cbd2f36ed8a4b825667016d6975b812a5b9f.tar.gz
rails-f798cbd2f36ed8a4b825667016d6975b812a5b9f.tar.bz2
rails-f798cbd2f36ed8a4b825667016d6975b812a5b9f.zip
Don't cache arguments in #find_by if they are an ActiveRecord::Relation
In this commit, find_by doesn't cache arguments so that find_by with association subquery works correctly. Fixes #20817
Diffstat (limited to 'activerecord/lib/active_record/core.rb')
-rw-r--r--activerecord/lib/active_record/core.rb2
1 files changed, 1 insertions, 1 deletions
diff --git a/activerecord/lib/active_record/core.rb b/activerecord/lib/active_record/core.rb
index 894d18b79e..7f66c83c06 100644
--- a/activerecord/lib/active_record/core.rb
+++ b/activerecord/lib/active_record/core.rb
@@ -177,7 +177,7 @@ module ActiveRecord
hash = args.first
return super if hash.values.any? { |v|
- v.nil? || Array === v || Hash === v
+ v.nil? || Array === v || Hash === v || Relation === v
}
# We can't cache Post.find_by(author: david) ...yet