aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord
diff options
context:
space:
mode:
authorSean Griffin <sean@seantheprogrammer.com>2017-07-24 10:56:23 -0400
committerSean Griffin <sean@seantheprogrammer.com>2017-07-24 10:58:00 -0400
commita69842447739d2f22657e347bad3b23c64b0c6b8 (patch)
tree9af2aa23d664b28c337167eaae8bb0b4b9b3a03e /activerecord
parent01425d8a714d05f3f906908e95ca29376af74c42 (diff)
downloadrails-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.
Diffstat (limited to 'activerecord')
-rw-r--r--activerecord/lib/active_record/relation/predicate_builder.rb4
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