From a69842447739d2f22657e347bad3b23c64b0c6b8 Mon Sep 17 00:00:00 2001 From: Sean Griffin Date: Mon, 24 Jul 2017 10:56:23 -0400 Subject: 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. --- activerecord/lib/active_record/relation/predicate_builder.rb | 4 ++++ 1 file changed, 4 insertions(+) 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 -- cgit v1.2.3