diff options
author | Ernie Miller <ernie@metautonomo.us> | 2010-03-30 08:45:09 -0400 |
---|---|---|
committer | Ernie Miller <ernie@metautonomo.us> | 2010-05-07 13:05:55 -0400 |
commit | 7e7a3548bb7e024b0bac0a03e3ac9f774c3486d4 (patch) | |
tree | 766645f1903e7b1d224937615b9333c0bf2c0d5f | |
parent | 32fbb70f100d0d6f9800020ef519a09a0852ae47 (diff) | |
download | rails-7e7a3548bb7e024b0bac0a03e3ac9f774c3486d4.tar.gz rails-7e7a3548bb7e024b0bac0a03e3ac9f774c3486d4.tar.bz2 rails-7e7a3548bb7e024b0bac0a03e3ac9f774c3486d4.zip |
Cleaner support for Ranges with excluded end.
-rw-r--r-- | lib/arel/engines/sql/predicates.rb | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/lib/arel/engines/sql/predicates.rb b/lib/arel/engines/sql/predicates.rb index 53bac7a2ca..7fac09e750 100644 --- a/lib/arel/engines/sql/predicates.rb +++ b/lib/arel/engines/sql/predicates.rb @@ -75,6 +75,16 @@ module Arel end class In < Binary + def to_sql + if operand2.is_a?(Range) && operand2.exclude_end? + GreaterThanOrEqualTo.new(operand1, operand2.begin).and( + LessThan.new(operand1, operand2.end) + ).to_sql + else + super + end + end + def predicate_sql; operand2.inclusion_predicate_sql end end |