diff options
author | Jon Leighton <j@jonathanleighton.com> | 2011-08-08 16:41:32 +0100 |
---|---|---|
committer | Jon Leighton <j@jonathanleighton.com> | 2011-08-08 16:41:32 +0100 |
commit | 8fe010a5370f5249de962e1ad345d29a00aec70d (patch) | |
tree | ba2db9697983f43f01564c387a4833866c841f57 /lib/arel/visitors | |
parent | ac4fe778577c8b1eea641ef04b4d2b81fc54694d (diff) | |
download | rails-8fe010a5370f5249de962e1ad345d29a00aec70d.tar.gz rails-8fe010a5370f5249de962e1ad345d29a00aec70d.tar.bz2 rails-8fe010a5370f5249de962e1ad345d29a00aec70d.zip |
Support update statements containing joins
Diffstat (limited to 'lib/arel/visitors')
-rw-r--r-- | lib/arel/visitors/to_sql.rb | 5 |
1 files changed, 1 insertions, 4 deletions
diff --git a/lib/arel/visitors/to_sql.rb b/lib/arel/visitors/to_sql.rb index 8aec4cb147..ec62f4fb89 100644 --- a/lib/arel/visitors/to_sql.rb +++ b/lib/arel/visitors/to_sql.rb @@ -142,7 +142,7 @@ key on UpdateManager using UpdateManager#key= (visit(o.top) if o.top), (visit(o.set_quantifier) if o.set_quantifier), ("#{o.projections.map { |x| visit x }.join ', '}" unless o.projections.empty?), - (visit(o.source) if o.source), + ("FROM #{visit(o.source)}" if o.source && !o.source.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?), (visit(o.having) if o.having), @@ -288,10 +288,7 @@ key on UpdateManager using UpdateManager#key= end def visit_Arel_Nodes_JoinSource o - return unless o.left || !o.right.empty? - [ - "FROM", (visit(o.left) if o.left), o.right.map { |j| visit j }.join(' ') ].compact.join ' ' |