Reputation: 7978
I have a namspaced resource, but I'd like a specific nested resource to route to a non-namespaced controller, e.g.:
namespace :admin do
resources :posts do # /admin/posts => Admin::PostsController
resources :audits, only: [:index] # /admin/posts/1/audits => AuditsController
end
end
The guides state that:
If you need to use a different controller namespace inside a namespace block you can specify an absolute controller path, e.g: get '/foo' => '/foo#index'.
but this results in "wrong constant name" because rails tries to convert admin//audits
in to a constant.
Upvotes: 3
Views: 2405
Reputation: 7978
I ended up just splitting it out completely and doing
get 'admin/users/:user_id/audits', to: 'audits#index'
Still don't really understand the quote from the guides, I assume it must be incorrect.
Upvotes: 2