diff options
author | Emilio Tagua <miloops@gmail.com> | 2010-09-11 11:34:18 +0800 |
---|---|---|
committer | Aaron Patterson <aaron.patterson@gmail.com> | 2010-09-11 13:18:20 +0800 |
commit | 5daafa8e959acc64fc19e9522470282ac0f25f33 (patch) | |
tree | 7ca526824f312ac79ca71e491d9df7ea86b5aca7 /lib/arel/visitors | |
parent | 8ce904933db3ec9884194f07881581ec0cc8281e (diff) | |
download | rails-5daafa8e959acc64fc19e9522470282ac0f25f33.tar.gz rails-5daafa8e959acc64fc19e9522470282ac0f25f33.tar.bz2 rails-5daafa8e959acc64fc19e9522470282ac0f25f33.zip |
Add Min node.
Diffstat (limited to 'lib/arel/visitors')
-rw-r--r-- | lib/arel/visitors/to_sql.rb | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/lib/arel/visitors/to_sql.rb b/lib/arel/visitors/to_sql.rb index 599a25836a..65dc5fdb83 100644 --- a/lib/arel/visitors/to_sql.rb +++ b/lib/arel/visitors/to_sql.rb @@ -100,6 +100,11 @@ module Arel visit x }.join(', ')})#{o.alias ? " AS #{visit o.alias}" : ''}" end + def visit_Arel_Nodes_Min o + "MIN(#{o.expressions.map { |x| + visit x }.join(', ')})#{o.alias ? " AS #{visit o.alias}" : ''}" + end + def visit_Arel_Nodes_Avg o "AVG(#{o.expressions.map { |x| visit x }.join(', ')})#{o.alias ? " AS #{visit o.alias}" : ''}" |