Skip to content
This repository
Browse code

Routing fix

git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@1712 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
  • Loading branch information...
commit 3b1d271e02e3f5b468b2a1ed3fc2a8bd2f228bd4 1 parent 870cca6
Jamis Buck authored July 05, 2005
4  actionpack/lib/action_controller/routing.rb
@@ -118,8 +118,8 @@ def write_dropout_generation(g)
118 118
         gp = g.dup # Use another generator to write the conditions after the first &&
119 119
         # We do this to ensure that the generator will not assume x_value is set. It will
120 120
         # not be set if it follows a false condition -- for example, false && (x = 2)
121  
-    
122  
-        gp.after.map {|c| c.default_check gp}
  121
+        
  122
+        check += gp.after.map {|c| c.default_check gp}
123 123
         gp.if(check.join(' && ')) { gp.finish } # If this condition is met, we stop here
124 124
         true 
125 125
       end
11  actionpack/test/controller/routing_test.rb
@@ -682,6 +682,17 @@ def test_changing_controller
682 682
       {:controller => 'admin/user', :action => 'index'}
683 683
     )
684 684
   end  
  685
+
  686
+  def test_backwards
  687
+    rs.draw do |map|
  688
+      rs.connect 'page/:id/:action', :controller => 'pages', :action => 'show'
  689
+      rs.connect ':controller/:action/:id'
  690
+    end
  691
+
  692
+    assert_equal ['/page/20', {}], rs.generate(:controller => 'pages', :id => 20)
  693
+    assert_equal ['/page/20', {}], rs.generate(:controller => 'pages', :id => 20, :action => 'show')
  694
+    assert_equal ['/pages/boo', {}], rs.generate(:controller => 'pages', :action => 'boo')
  695
+  end
685 696
 end
686 697
 
687 698
 end

0 notes on commit 3b1d271

Please sign in to comment.
Something went wrong with that request. Please try again.