Adding prefix to a named route helper under namespace

好久不见. 提交于 2019-11-30 10:20:09

Just try the code in routes.

namespace :admin, as: '' do
   get '/post/new' => 'posts#new', as: 'new_admin_post'
end

If you don't want to make admin namespace as nil, then you can do it. for that you need to put that route out of the namespace :admin block in routes

namespace :admin do
   # your other routes
end

get '/admin/post/new' => 'admin/posts#new', :as => 'new_admin_post'
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!