如何从路由 (URL) 中删除控制器名称



如何从路由(URL(中删除控制器名称?

Example :
Existing Url: https://localhost:3000/home/contact_us
I want this URL https://localhost:3000/contact_us

那我该怎么做呢?

路线.rb

获取"home/contact_us",至:"home#contact_us",如::contact_us

试试

get "contact_us", to: "home#contact_us", as: :contact_us

get "contact_us", to: "home#contact_us"

as: :contact_us # not required

最新更新