Permalink
Browse files

Routing fix

git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@1712 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
  • Loading branch information...
1 parent 870cca6 commit 3b1d271e02e3f5b468b2a1ed3fc2a8bd2f228bd4 @jamis jamis committed Jul 5, 2005
Showing with 13 additions and 2 deletions.
  1. +2 −2 actionpack/lib/action_controller/routing.rb
  2. +11 −0 actionpack/test/controller/routing_test.rb
@@ -118,8 +118,8 @@ def write_dropout_generation(g)
gp = g.dup # Use another generator to write the conditions after the first &&
# We do this to ensure that the generator will not assume x_value is set. It will
# not be set if it follows a false condition -- for example, false && (x = 2)
-
- gp.after.map {|c| c.default_check gp}
+
+ check += gp.after.map {|c| c.default_check gp}
gp.if(check.join(' && ')) { gp.finish } # If this condition is met, we stop here
true
end
@@ -682,6 +682,17 @@ def test_changing_controller
{:controller => 'admin/user', :action => 'index'}
)
end
+
+ def test_backwards
+ rs.draw do |map|
+ rs.connect 'page/:id/:action', :controller => 'pages', :action => 'show'
+ rs.connect ':controller/:action/:id'
+ end
+
+ assert_equal ['/page/20', {}], rs.generate(:controller => 'pages', :id => 20)
+ assert_equal ['/page/20', {}], rs.generate(:controller => 'pages', :id => 20, :action => 'show')
+ assert_equal ['/pages/boo', {}], rs.generate(:controller => 'pages', :action => 'boo')
+ end
end
end

0 comments on commit 3b1d271

Please sign in to comment.