我有一个名称空间"shop".在该命名空间中,我有一个资源"新闻".
namespace :shop do
resources :news
end
Run Code Online (Sandbox Code Playgroud)
我现在需要的是,我的"新闻"路线可以获得一个新参数:
/shop/nike (landing page -> goes to "news#index", :identifier => "nike")
/shop/adidas (landing page -> goes to "news#index", :identifier => "adidas")
/shop/nike/news
/shop/adidas/news
Run Code Online (Sandbox Code Playgroud)
所以我可以得到商店并过滤我的新闻.
我需要一条路线:
/shop/:identfier/:controller/:action/:id
Run Code Online (Sandbox Code Playgroud)
我测试了很多变化,但我不能让它运行.
任何人都可以给我一个提示?谢谢.