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
end
@ast.with = node_class.new(subqueries.flatten)
self
end
def take limit

View file

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