diff options
Diffstat (limited to 'lib')
-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 22f7943ab9..264521f4c6 100644 --- a/lib/arel/visitors/to_sql.rb +++ b/lib/arel/visitors/to_sql.rb @@ -429,8 +429,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 |