我的路线:
resources :events, :path_names => { :new => "organize" } do
resources :forums
end
通过这些路线,我会得到像/events/:event_id/forums/organize
这样的网址。我不希望path_names传播到我的嵌套路由......我是否必须为它们重新定义path_names
?或者使用scope
?
resources :events, :path_names => { :new => "organize" } do
scope :path_names => { :new => "new" } do
resources :forums
# other nested resources...
end
end
或者(我最喜欢的,直到找到更好的解决方案;))
resources :events, :path_names => { :new => "organize" }
resources :events, :only => [] do
#nested resources...
end
有更优雅的方法吗?如果你不这么认为,你也可以告诉我你认为哪一个是最好的。
答案 0 :(得分:0)
我选择了最后一个选项:
resources :events, :path_names => { :new => "organize" }
resources :events, :only => [] do
#nested resources...
end