diff options
author | Aaron Patterson <aaron.patterson@gmail.com> | 2010-08-23 10:14:02 -0700 |
---|---|---|
committer | Aaron Patterson <aaron.patterson@gmail.com> | 2010-08-23 10:14:02 -0700 |
commit | 2579fec805f23903dd6c4f1726198e010f5a9a54 (patch) | |
tree | 6dfbfbe4829a1a3f0c6e92e773d1f470bf111cf1 /lib/arel/visitors | |
parent | a3b8ef8375056cd3b6a8cea49dec671f2a8f6c41 (diff) | |
download | rails-2579fec805f23903dd6c4f1726198e010f5a9a54.tar.gz rails-2579fec805f23903dd6c4f1726198e010f5a9a54.tar.bz2 rails-2579fec805f23903dd6c4f1726198e010f5a9a54.zip |
adding count nodes
Diffstat (limited to 'lib/arel/visitors')
-rw-r--r-- | lib/arel/visitors/to_sql.rb | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/lib/arel/visitors/to_sql.rb b/lib/arel/visitors/to_sql.rb index 55ed53177e..05c33ddb8b 100644 --- a/lib/arel/visitors/to_sql.rb +++ b/lib/arel/visitors/to_sql.rb @@ -58,6 +58,10 @@ module Arel ].compact.join ' ' end + def visit_Arel_Nodes_Count o + "COUNT(#{o.distinct ? 'DISTINCT ' : ''}#{o.expressions.map { |x| visit x }.join(', ')})" + end + def visit_Arel_Nodes_TableAlias o "#{visit o.relation} #{quote_table_name o.name}" end |