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

totally lame, but arel expects FROM to only be one item

上级 af61eedc
module Arel
module Nodes
class SelectCore
attr_reader :froms, :projections, :wheres, :groups
attr_accessor :froms, :projections, :wheres, :groups
attr_accessor :having
def initialize
......
......@@ -51,11 +51,7 @@ def group *columns
end
def from table
if String === table
return self if @ctx.froms.any? { |x| x.name.to_s == table }
end
@ctx.froms << table
@ctx.froms = [table]
self
end
......
......@@ -60,7 +60,7 @@ def execute sql, name = nil
manager.from table
manager.from 'users'
manager.project table['id']
manager.to_sql.should be_like 'SELECT "users"."id" FROM "users"'
manager.to_sql.should be_like 'SELECT "users"."id" FROM \'users\''
end
end
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册