提交 3b1d271e 编写于 作者: J Jamis Buck

Routing fix


git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@1712 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
上级 870cca68
......@@ -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
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册