diff options
Diffstat (limited to 'lib/arel/visitors/to_sql.rb')
-rw-r--r-- | lib/arel/visitors/to_sql.rb | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/lib/arel/visitors/to_sql.rb b/lib/arel/visitors/to_sql.rb index e1cf0f3778..48c8c492e0 100644 --- a/lib/arel/visitors/to_sql.rb +++ b/lib/arel/visitors/to_sql.rb @@ -57,10 +57,15 @@ module Arel "SELECT #{o.projections.map { |x| visit x }.join ', '}", ("FROM #{o.froms.map { |x| visit x }.join ', ' }" unless o.froms.empty?), ("WHERE #{o.wheres.map { |x| visit x }.join ' AND ' }" unless o.wheres.empty?), - ("GROUP BY #{o.groups.map { |x| visit x }.join ', ' }" unless o.groups.empty?) + ("GROUP BY #{o.groups.map { |x| visit x }.join ', ' }" unless o.groups.empty?), + (visit(o.having) if o.having), ].compact.join ' ' end + def visit_Arel_Nodes_Having o + "HAVING #{visit o.expr}" + end + def visit_Arel_Nodes_Group o visit o.expr end |