aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorEmilio Tagua <miloops@gmail.com>2010-03-29 12:31:25 -0300
committerEmilio Tagua <miloops@gmail.com>2010-03-29 12:31:25 -0300
commit233ee77f4511255ff2ff7c0b0ebf1cee13e7fc10 (patch)
tree199c420bf7b8be9d4e33a2c9d1d7c4ebe6e4e366 /lib
parentaa9559c39999030aee24391f6a09f1116672a471 (diff)
downloadrails-233ee77f4511255ff2ff7c0b0ebf1cee13e7fc10.tar.gz
rails-233ee77f4511255ff2ff7c0b0ebf1cee13e7fc10.tar.bz2
rails-233ee77f4511255ff2ff7c0b0ebf1cee13e7fc10.zip
Handle ranges with excluded end.
Diffstat (limited to 'lib')
-rw-r--r--lib/arel/algebra/attributes/attribute.rb6
1 files changed, 5 insertions, 1 deletions
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