diff options
Diffstat (limited to 'lib/active_relation/extensions')
-rw-r--r-- | lib/active_relation/extensions/array.rb | 4 | ||||
-rw-r--r-- | lib/active_relation/extensions/range.rb | 9 |
2 files changed, 13 insertions, 0 deletions
diff --git a/lib/active_relation/extensions/array.rb b/lib/active_relation/extensions/array.rb index c07819d35f..2af5832707 100644 --- a/lib/active_relation/extensions/array.rb +++ b/lib/active_relation/extensions/array.rb @@ -6,4 +6,8 @@ class Array def to_sql(formatter = nil) "(" + collect { |e| e.to_sql(formatter) }.join(', ') + ")" end + + def predicate_sql + "IN" + end end
\ No newline at end of file diff --git a/lib/active_relation/extensions/range.rb b/lib/active_relation/extensions/range.rb new file mode 100644 index 0000000000..0218a0ab44 --- /dev/null +++ b/lib/active_relation/extensions/range.rb @@ -0,0 +1,9 @@ +class Range + def to_sql(formatter = nil) + formatter.range self.begin, self.end + end + + def predicate_sql + "BETWEEN" + end +end
\ No newline at end of file |