diff options
author | Sean Griffin <sean@seantheprogrammer.com> | 2017-07-24 10:56:23 -0400 |
---|---|---|
committer | Sean Griffin <sean@seantheprogrammer.com> | 2017-07-24 10:58:00 -0400 |
commit | a69842447739d2f22657e347bad3b23c64b0c6b8 (patch) | |
tree | 9af2aa23d664b28c337167eaae8bb0b4b9b3a03e | |
parent | 01425d8a714d05f3f906908e95ca29376af74c42 (diff) | |
download | rails-a69842447739d2f22657e347bad3b23c64b0c6b8.tar.gz rails-a69842447739d2f22657e347bad3b23c64b0c6b8.tar.bz2 rails-a69842447739d2f22657e347bad3b23c64b0c6b8.zip |
Fix build failures on PG
Honestly I don't think the tests that are fixed by this change should
have been merged. Passing a range or an array to `where` has a special
meaning. We need to solve the problem more concretely without overriding
the behavior that is present for *every* other type.
However, the damage has been done. These changes were in 5.1, so we need
a deprecation cycle to remove it.
-rw-r--r-- | activerecord/lib/active_record/relation/predicate_builder.rb | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/activerecord/lib/active_record/relation/predicate_builder.rb b/activerecord/lib/active_record/relation/predicate_builder.rb index ee7fef4711..5c42414072 100644 --- a/activerecord/lib/active_record/relation/predicate_builder.rb +++ b/activerecord/lib/active_record/relation/predicate_builder.rb @@ -85,6 +85,10 @@ module ActiveRecord expand_from_hash(query).reduce(&:and) end queries.reduce(&:or) + # FIXME: Deprecate this and provide a public API to force equality + elsif (value.is_a?(Range) || value.is_a?(Array)) && + table.type(key.to_s).respond_to?(:subtype) + BasicObjectHandler.new(self).call(table.arel_attribute(key), value) else build(table.arel_attribute(key), value) end |