Permalink
Browse files

fix depth first visitor to support ascending and descending nodes

  • Loading branch information...
tenderlove committed Jun 29, 2011
1 parent da99e80 commit 7832cd3bb3c6cfd76fdb63ca75995f2e6c87757c
Showing with 17 additions and 0 deletions.
  1. +6 −0 History.txt
  2. +2 −0 lib/arel/visitors/depth_first.rb
  3. +9 −0 test/test_select_manager.rb
View
@@ -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
@@ -23,6 +23,8 @@ def unary o
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
@@ -412,6 +412,15 @@ def test_join_sources
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

5 comments on commit 7832cd3

@metaskills

This comment has been minimized.

Show comment Hide comment
@metaskills

metaskills Jul 17, 2011

Aaron, I have been fielding a fair amount of support emails for testing rails 3.1 with the adapter. It would help immensely if this change with 2.1.4 was released and rails was told to use it for 3-1-stable.

Aaron, I have been fielding a fair amount of support emails for testing rails 3.1 with the adapter. It would help immensely if this change with 2.1.4 was released and rails was told to use it for 3-1-stable.

@metaskills

This comment has been minimized.

Show comment Hide comment
@metaskills

metaskills Jul 17, 2011

Aaron, should this have made it into 2-0-stable too or is master considered 2-1-stable?

Aaron, should this have made it into 2-0-stable too or is master considered 2-1-stable?

@bbuchalter

This comment has been minimized.

Show comment Hide comment
@bbuchalter

bbuchalter Jul 20, 2011

I concur with @metaskills first comment - I'm trying to use rails-3-1-stable, but I need some of the recent fixes post arel-2.1.2.

I concur with @metaskills first comment - I'm trying to use rails-3-1-stable, but I need some of the recent fixes post arel-2.1.2.

@tenderlove

This comment has been minimized.

Show comment Hide comment
@tenderlove

tenderlove Jul 20, 2011

Owner

I need to fix a few more bugs before I make a point release. I'll release one soon. :'(

Owner

tenderlove replied Jul 20, 2011

I need to fix a few more bugs before I make a point release. I'll release one soon. :'(

@bbuchalter

This comment has been minimized.

Show comment Hide comment
@bbuchalter

bbuchalter Jul 20, 2011

Please sign in to comment.