Reputation: 513
I have a project with structure: Module XXX, it has some models, controllers, etc. Inside that module I have Admin module. For example, when I define routes:
scope module: 'xxx' do
namespace :admin do
resources :pages
end
end
I get helper for 'new' action: 'new_admin_page_path'. It doesn't looks pretty good. I want it to has something like 'admin_new_page_path'. I may be wrong but I think this name looks better. How can I do it in more correct way? Is it possible to have 'xxx_admin_new_page_path'?
UPD: I want all actions to have this format, not only new. For example: xxx_admin_pages_path, xxx_admin_new_page_path, xxx_admin_edit_page_path and xxx_admin_page_path
Upvotes: 1
Views: 60
Reputation: 1340
There is no documentation on doing this with resources. AFAIK it's not possible.
scope 'xxx', as: :xxx do
scope 'admin', as: :admin do
get 'pages', controller: 'posts', action: 'index', as: :pages
get 'pages/new', controller: 'posts', action: 'index', as: :new_pages
end
end
Upvotes: 1