From 7110dbea008dd4b80d1764003935a3c97ab10f57 Mon Sep 17 00:00:00 2001 From: Greg Navis Date: Wed, 9 Jan 2019 18:17:40 +0100 Subject: Support endless ranges in where This commit adds support for endless ranges, e.g. (1..), that were added in Ruby 2.6. They're functionally equivalent to explicitly specifying Float::INFINITY as the end of the range. --- activerecord/lib/arel/predications.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'activerecord/lib/arel') diff --git a/activerecord/lib/arel/predications.rb b/activerecord/lib/arel/predications.rb index 28679ae892..0c03e93138 100644 --- a/activerecord/lib/arel/predications.rb +++ b/activerecord/lib/arel/predications.rb @@ -36,14 +36,14 @@ module Arel # :nodoc: all def between(other) if infinity?(other.begin) - if infinity?(other.end) + if other.end.nil? || infinity?(other.end) not_in([]) elsif other.exclude_end? lt(other.end) else lteq(other.end) end - elsif infinity?(other.end) + elsif other.end.nil? || infinity?(other.end) gteq(other.begin) elsif other.exclude_end? gteq(other.begin).and(lt(other.end)) -- cgit v1.2.3