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

fix depth first visitor to support ascending and descending nodes

This commit is contained in:
Aaron Patterson 2011-06-29 13:45:26 -07:00
parent da99e80670
commit 7832cd3bb3
3 changed files with 17 additions and 0 deletions

View file

@ -1,3 +1,9 @@
== 2.1.4 / unreleased
* Bug Fixes
* Fix depth-first traversal to understand ascending / descending nodes.
== 2.1.3 / 2011-06-27
* Bug Fixues

View file

@ -23,6 +23,8 @@ module Arel
alias :visit_Arel_Nodes_Offset :unary
alias :visit_Arel_Nodes_On :unary
alias :visit_Arel_Nodes_Ordering :unary
alias :visit_Arel_Nodes_Ascending :unary
alias :visit_Arel_Nodes_Descending :unary
alias :visit_Arel_Nodes_Top :unary
alias :visit_Arel_Nodes_UnqualifiedColumn :unary

View file

@ -412,6 +412,15 @@ module Arel
ast = mgr.ast
mgr.visitor.accept(ast).must_equal mgr.to_sql
end
it 'should allow orders to work when the ast is grepped' do
table = Table.new :users
mgr = table.from table
mgr.project Arel.sql '*'
mgr.from table
mgr.orders << Arel::Nodes::Ascending.new(Arel.sql('foo'))
mgr.ast.grep(Arel::Nodes::OuterJoin)
mgr.to_sql.must_be_like %{ SELECT * FROM "users" ORDER BY foo ASC }
end
end
describe 'taken' do