diff options
-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 |