0
我现在有看起来像这样的特定资源的URL:我可以在控制器和:id之间使用没有路径分隔符的Rails路由吗?
http://test.litmus.local/tests/186/versions/8/screenshots
我希望它看起来像这样:
http://test.litmus.local/tests/186/v8/screenshots
是否有更改版本的方式/ :version_id到v:version_id?
这里就是目前看起来我对这些资源的途径,如:
map.resources :tests do |test|
test.resources :versions, :path_prefix => '/tests/:test_id' do |version|
version.section '/:section', :controller => "versions", :action => 'show', :requirements => { :section => /...blah.../ }
end
end
我省略了什么无关,所以道歉,如果我打破任何东西。
我使用Rails 2.3.11
我这样做,然后覆盖版本#to_param。我还必须在控制器的before_filter中删除'v'。似乎是完美的工作,谢谢! –