From 233ee77f4511255ff2ff7c0b0ebf1cee13e7fc10 Mon Sep 17 00:00:00 2001 From: Emilio Tagua Date: Mon, 29 Mar 2010 12:31:25 -0300 Subject: [PATCH] Handle ranges with excluded end. --- lib/arel/algebra/attributes/attribute.rb | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/lib/arel/algebra/attributes/attribute.rb b/lib/arel/algebra/attributes/attribute.rb index b372be5e1d..331f218463 100644 --- a/lib/arel/algebra/attributes/attribute.rb +++ b/lib/arel/algebra/attributes/attribute.rb @@ -111,7 +111,11 @@ module Arel end def in(array) - Predicates::In.new(self, array) + if array.is_a?(Range) && array.exclude_end? + [Predicates::GreaterThanOrEqualTo.new(self, array.begin), Predicates::LessThan.new(self, array.end)] + else + Predicates::In.new(self, array) + end end end include Predications