aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib/active_record/core.rb
diff options
context:
space:
mode:
authorMatthew Draper <matthew@trebex.net>2017-08-02 20:31:22 +0930
committerGitHub <noreply@github.com>2017-08-02 20:31:22 +0930
commit75436a49843c4a5f27b11bcb6ce4ccbdbb7a5f7a (patch)
treeb8765ff0e7cba8790c806b095535882964d0a13f /activerecord/lib/active_record/core.rb
parent73f887af620371e1229dc10d809e45335b6f7bba (diff)
parent0d56480c4b547915f99f3581065e52a48bd98ca1 (diff)
downloadrails-75436a49843c4a5f27b11bcb6ce4ccbdbb7a5f7a.tar.gz
rails-75436a49843c4a5f27b11bcb6ce4ccbdbb7a5f7a.tar.bz2
rails-75436a49843c4a5f27b11bcb6ce4ccbdbb7a5f7a.zip
Merge pull request #29842 from kamipo/fix_find_by_with_range
Fix `find_by` with range conditions
Diffstat (limited to 'activerecord/lib/active_record/core.rb')
-rw-r--r--activerecord/lib/active_record/core.rb5
1 files changed, 2 insertions, 3 deletions
diff --git a/activerecord/lib/active_record/core.rb b/activerecord/lib/active_record/core.rb
index 8b97dbe5bf..cdd3b5114a 100644
--- a/activerecord/lib/active_record/core.rb
+++ b/activerecord/lib/active_record/core.rb
@@ -168,8 +168,7 @@ module ActiveRecord
id = ids.first
- return super if id.kind_of?(Array) ||
- id.is_a?(ActiveRecord::Base)
+ return super if StatementCache.unsupported_value?(id)
key = primary_key
@@ -194,7 +193,7 @@ module ActiveRecord
hash = args.first
return super if !(Hash === hash) || hash.values.any? { |v|
- v.nil? || Array === v || Hash === v || Relation === v || Base === v
+ StatementCache.unsupported_value?(v)
}
# We can't cache Post.find_by(author: david) ...yet