新手问题 如何把 admin 的 routes 设置成其它名字

luffycn · December 21, 2014 · Last by zhangyuan replied at December 22, 2014 · 1927 hits

如果定义好的 admin controllers 目录 controllers/admin/ 想在 URL 访问时,变成 localhost:3000/other_admin_name

改成其它的 admin 名称,在 routes 要怎么配置了

如果是 resources

resources :admin, as: 'other_admin_name'

如果是单独配的 controller

get 'other_admin_name', to: 'admin#index'

详细信息可以看 Rails 的文档 http://guides.rubyonrails.org/routing.html

use :path option

You need to Sign in before reply, if you don't have an account, please Sign up first.