我将Rails-2应用程序转换为Rails-3。在我的Rails-2路由中,我有如下所示的路由
Rails 2
map.connect 'example/:action/:id.:format', :controller => 'Test',:q =>'example-string'注意:这在Rails-2应用程序中运行良好;当url附带/example时,它用参数q="example-string"重定向到Test的索引操作
我将上面的内容转换为支持Rails-3条路线:
match 'example(/:action(/:id.(:format)))',:to => 'Test',:q=>'example-stirng'问题是我没有找到路由错误/example。
如何将Rails-2路线改为Rails-3路线?
发布于 2011-01-06 12:44:02
你差点就猜对了。应该是
match 'example(/:action(/:id.(:format)))',:controller => :test, :q=>'example-stirng':to => "foo#bar"是:controller => :foo, :action => :bar的快捷方式
https://stackoverflow.com/questions/4613379
复制相似问题