1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00

Make #with chainable

This commit is contained in:
Paul Sadauskas 2011-01-25 11:27:42 -07:00 committed by Aaron Patterson
parent 7b445c6dd5
commit b4ca49dd9f
2 changed files with 3 additions and 4 deletions

View file

@ -161,6 +161,8 @@ module Arel
node_class = Nodes::With node_class = Nodes::With
end end
@ast.with = node_class.new(subqueries.flatten) @ast.with = node_class.new(subqueries.flatten)
self
end end
def take limit def take limit

View file

@ -288,9 +288,7 @@ module Arel
as_statement = Arel::Nodes::As.new replies, union as_statement = Arel::Nodes::As.new replies, union
manager = Arel::SelectManager.new Table.engine manager = Arel::SelectManager.new Table.engine
manager.from replies manager.with(:recursive, as_statement).from(replies).project(Arel.star)
manager.with :recursive, as_statement
manager.project Arel.star
sql = manager.to_sql sql = manager.to_sql
sql.must_be_like %{ sql.must_be_like %{
@ -302,7 +300,6 @@ module Arel
SELECT * FROM "replies" SELECT * FROM "replies"
} }
end end
end end
describe 'ast' do describe 'ast' do