提交 9c4670c6 编写于 作者: A Aaron Patterson

moving visitor logic to the visitor

上级 55d1f9fd
......@@ -44,9 +44,7 @@ def take limit
def join_sql
viz = Visitors::JoinSql.new @engine
Nodes::SqlLiteral.new(
@ctx.froms.grep(Nodes::Join).map { |x| viz.accept x }.join ', '
)
Nodes::SqlLiteral.new viz.accept @ctx
end
def joins manager
......
......@@ -9,6 +9,10 @@ module Visitors
# This visitor is used in SelectManager#join_sql and is for backwards
# compatibility with Arel V1.0
class JoinSql < Arel::Visitors::ToSql
def visit_Arel_Nodes_SelectCore o
o.froms.grep(Nodes::Join).map { |x| visit x }.join ', '
end
def visit_Arel_Nodes_OuterJoin o
"OUTER JOIN #{visit o.right} #{visit o.constraint}"
end
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册