diff options
Diffstat (limited to 'lib/arel/visitors')
-rw-r--r-- | lib/arel/visitors/to_sql.rb | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/lib/arel/visitors/to_sql.rb b/lib/arel/visitors/to_sql.rb index 8c63070084..ae1b7930af 100644 --- a/lib/arel/visitors/to_sql.rb +++ b/lib/arel/visitors/to_sql.rb @@ -436,8 +436,12 @@ module Arel end def visit_Arel_Nodes_Grouping o, collector - collector << "(" - visit(o.expr, collector) << ")" + if o.expr.is_a? Nodes::Grouping + visit(o.expr, collector) + else + collector << "(" + visit(o.expr, collector) << ")" + end end def visit_Arel_SelectManager o, collector |