diff options
author | Aaron Patterson <aaron.patterson@gmail.com> | 2010-09-15 10:50:20 -0700 |
---|---|---|
committer | Aaron Patterson <aaron.patterson@gmail.com> | 2010-09-15 10:50:20 -0700 |
commit | f4ea59ab4d76a2745ebf50f65bfbfe26f9db7195 (patch) | |
tree | 13c48c0516048f1e99ab3ef5c852ba99dec7ad86 /lib/arel | |
parent | ed6192c55b8e77b60e4203dc30ae056f222a1499 (diff) | |
download | rails-f4ea59ab4d76a2745ebf50f65bfbfe26f9db7195.tar.gz rails-f4ea59ab4d76a2745ebf50f65bfbfe26f9db7195.tar.bz2 rails-f4ea59ab4d76a2745ebf50f65bfbfe26f9db7195.zip |
JoinSql visitor will visit left side if left is a join
Diffstat (limited to 'lib/arel')
-rw-r--r-- | lib/arel/visitors/join_sql.rb | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/lib/arel/visitors/join_sql.rb b/lib/arel/visitors/join_sql.rb index ab3d10f99c..099e78b692 100644 --- a/lib/arel/visitors/join_sql.rb +++ b/lib/arel/visitors/join_sql.rb @@ -17,15 +17,21 @@ module Arel [ (visit o.left if Nodes::Join === o.left), visit(o.right) - ].join ' ' + ].compact.join ' ' end def visit_Arel_Nodes_OuterJoin o - "LEFT OUTER JOIN #{visit o.right} #{visit o.constraint}" + [ + (visit o.left if Nodes::Join === o.left), + "LEFT OUTER JOIN #{visit o.right} #{visit o.constraint if o.constraint}" + ].compact.join ' ' end def visit_Arel_Nodes_InnerJoin o - "INNER JOIN #{visit o.right} #{visit o.constraint if o.constraint}" + [ + (visit o.left if Nodes::Join === o.left), + "INNER JOIN #{visit o.right} #{visit o.constraint if o.constraint}" + ].compact.join ' ' end end end |