diff options
author | Ryuta Kamizono <kamipo@gmail.com> | 2017-07-19 08:18:43 +0900 |
---|---|---|
committer | Ryuta Kamizono <kamipo@gmail.com> | 2017-07-20 00:50:59 +0900 |
commit | 0d56480c4b547915f99f3581065e52a48bd98ca1 (patch) | |
tree | 327f0a44a421c44340361648877b585c8c977b0d /activerecord/lib/active_record/statement_cache.rb | |
parent | 1f7f872ac6c8b57af6e0117bde5f6c38d0bae923 (diff) | |
download | rails-0d56480c4b547915f99f3581065e52a48bd98ca1.tar.gz rails-0d56480c4b547915f99f3581065e52a48bd98ca1.tar.bz2 rails-0d56480c4b547915f99f3581065e52a48bd98ca1.zip |
Fix `find_by` with range conditions
`StatementCache` doesn't support range conditions. So we need to through
the args to `FinderMethods#find_by` if range value is passed.
Diffstat (limited to 'activerecord/lib/active_record/statement_cache.rb')
-rw-r--r-- | activerecord/lib/active_record/statement_cache.rb | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/activerecord/lib/active_record/statement_cache.rb b/activerecord/lib/active_record/statement_cache.rb index 1877489e55..ceb7c66766 100644 --- a/activerecord/lib/active_record/statement_cache.rb +++ b/activerecord/lib/active_record/statement_cache.rb @@ -106,6 +106,11 @@ module ActiveRecord klass.find_by_sql(sql, bind_values, preparable: true, &block) end - alias :call :execute + + def self.unsupported_value?(value) + case value + when NilClass, Array, Range, Hash, Relation, Base then true + end + end end end |