Ruby on rails 这些rails 2路线在rails 3中应该是什么样子?

Ruby on rails 这些rails 2路线在rails 3中应该是什么样子?,ruby-on-rails,ruby,Ruby On Rails,Ruby,url是mysite.com/lists/student,其中lists是安装在重定向到rails应用程序的子域上的rails应用程序 rails 2是: map.connect ':controller/:action/:id' map.connect ':controller/:action/:id.:format' map.connect "student", :controller => 'student', :action => 'index' 对于rails

url是mysite.com/lists/student,其中lists是安装在重定向到rails应用程序的子域上的rails应用程序

rails 2是:

  map.connect ':controller/:action/:id'
  map.connect ':controller/:action/:id.:format'
  map.connect "student", :controller => 'student', :action => 'index'
对于rails 3,我尝试了以下方法:

 match "/student/" => "student#index"
 match 'student/:id', :to => 'student#index'
 match ':controller(/:action(/:id))(.:format);
但不起作用


“rake routes”不提供任何输出。

如果要使用
match
,则必须指定正在使用的HTTP谓词。有关更多详细信息,请参阅。一个简单的例子是:

match '/student', to: 'student#index', via: :index
我建议根据上面的Rails路由指南更改您的路由。例如,假设这些是
get
请求:

get '/student', to: 'student#index'
get 'student/:id', to: 'student#show'
get ':controller(/:action(/:id))'

如果要使用
match
,则必须指定正在使用的HTTP谓词。有关更多详细信息,请参阅。一个简单的例子是:

match '/student', to: 'student#index', via: :index
我建议根据上面的Rails路由指南更改您的路由。例如,假设这些是
get
请求:

get '/student', to: 'student#index'
get 'student/:id', to: 'student#show'
get ':controller(/:action(/:id))'

通过“
rake routes
不提供任何输出”您的意思是没有任何输出吗?在这种情况下,您可能没有正确迁移项目。看看这篇文章:无论如何,
match“students”=>“students#index”
应该可以工作。我很想使用rails#u升级插件来简化迁移,但我使用的是共享主机解决方案,我认为我没有权限更改ruby版本,因此无法从1.9.3切换回1.8。我已将.bashrc和.bash_配置文件更新为1.8版本,但ruby版本仍停留在1.9.3版本。通过“
rake routes
不提供任何输出”是否意味着没有任何输出?在这种情况下,您可能没有正确迁移项目。看看这篇文章:无论如何,
match“students”=>“students#index”
应该可以工作。我很想使用rails#u升级插件来简化迁移,但我使用的是共享主机解决方案,我认为我没有权限更改ruby版本,因此无法从1.9.3切换回1.8。我已将.bashrc和.bash_配置文件更新到1.8版本,但ruby版本仍停留在1.9.3版本。