私はこれを持っています
devise_for :users
resources :sites do
resources :users
get 'companies/search'
end
root :to => "welcome#index"
end
ルートは次のようになります
site_users GET /sites/:site_id/users(.:format) users#index
POST /sites/:site_id/users(.:format) users#create
new_site_user GET /sites/:site_id/users/new(.:format) users#new
edit_site_user GET /sites/:site_id/users/:id/edit(.:format) users#edit
site_user GET /sites/:site_id/users/:id(.:format) users#show
PUT /sites/:site_id/users/:id(.:format) users#update
DELETE /sites/:site_id/users/:id(.:format) users#destroy
site_companies_search GET /sites/:site_id/companies/search(.:format) sites/:site_id/companies#search
sites GET /sites(.:format) sites#index
POST /sites(.:format) sites#create
new_site GET /sites/new(.:format) sites#new
edit_site GET /sites/:id/edit(.:format) sites#edit
site GET /sites/:id(.:format) sites#show
PUT /sites/:id(.:format) sites#update
DELETE /sites/:id(.:format) sites#destroy
root / welcome#index
しかし、このようなルートを持つ方法があるかどうか知りたい
site_users GET /:site_id/users(.:format) users#index
POST /:site_id/users(.:format) users#create
new_site_user GET /:site_id/users/new(.:format) users#new
edit_site_user GET /:site_id/users/:id/edit(.:format) users#edit
site_user GET /:site_id/users/:id(.:format) users#show
PUT /:site_id/users/:id(.:format) users#update
DELETE /:site_id/users/:id(.:format) users#destroy
URL に /sites がないため、URL は
/sites/some_name/users
/sites/some_name/users/new
に
/some_name/users
/some_name/users/new
可能であればURLをクリーンアップします