diff options
author | Rafael Mendonça França <rafaelmfranca@gmail.com> | 2014-09-12 17:39:40 -0300 |
---|---|---|
committer | Rafael Mendonça França <rafaelmfranca@gmail.com> | 2014-09-12 17:39:40 -0300 |
commit | f8c0202f46e52761082c6ff4a1f3eedec1d1ddc2 (patch) | |
tree | 7a3a8a77e7617326d86d0f775ed6ed61fa12075f /lib | |
parent | 36836fa5e7c084c0dce2818577e6fd0cf815f786 (diff) | |
parent | 416ad003716bcc883c319ec30644bab8a3cf52c7 (diff) | |
download | rails-f8c0202f46e52761082c6ff4a1f3eedec1d1ddc2.tar.gz rails-f8c0202f46e52761082c6ff4a1f3eedec1d1ddc2.tar.bz2 rails-f8c0202f46e52761082c6ff4a1f3eedec1d1ddc2.zip |
Merge pull request #277 from sergey-alekseev/wrap-nested-gropings-only-once
Wrap nested Nodes::Grouping in brackets only once
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 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 |