【发布时间】:2012-01-11 09:55:14
【问题描述】:
有没有办法我可以自动路由 - http://localhost:3000/pages/1 到 http://localhost:3000/home 以及我网站中的所有其他页面,即 - http://localhost:3000/pages/4 到 http://localhost:3000/contact-us?
我可以用另一种方式做到这一点 -
match "/home" => 'pages#show', :id => 1
match "/cars-for-sale" => 'pages#show', :id => 1
match "/contact-us" => 'pages#show', :id => 4
但如果可能的话,需要反向并自动执行此操作。
【问题讨论】:
标签: ruby-on-rails ruby-on-rails-3 routing url-routing custom-routes