Answer the question
In order to leave comments, you need to log in
Routes.rb - How to remove controller name from URL?
There are two nested resources. How can I get rid of the nested resource controller name?
If you add :path => '' to the :bar resource, then the URI Pattern expects :foo_id instead of :id.
# routes.rb
namespace :admin do
resources :foo, :path => '' do
resources :bar
end
end
Answer the question
In order to leave comments, you need to log in
Example::Application.routes.draw do
scope :admin do
resources :foo, except: [:show], path: ''
resources :foo, only: [], path: '' do
resources :bar, path: ''
end
end
end
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question