Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我的 routes.rb 文件中有
resources :shops
我想要的,因为我想分隔索引并显示路线,但这会导致 /shops/ url
我真的很想把它做成 /shop - 最简单的方法是什么?
谢谢!
如果您希望它们全部成为/shop shop/1等,那么请执行以下操作:
/shop
shop/1
resources :shops, path: "shop"
否则也许你可以做
resources :shops, except: :show # then resources :shops, only: :show, path: "shop" # or get "shop/:id", to: "shops#show", as: :shop