我有以下路线
resources :eclubs, except: [:show]
namespace :eclubs do
resources :leaders, only: [:index, :show, :new, :create, :destroy]
resources :members, only: [:index, :show, :new, :create, :destroy]
end
但是,/ eclubs / members不会路由到Eclubs :: Members控制器的索引操作。相反,它路由到Eclubs控制器的show动作。我该如何解决这个问题?
答案 0 :(得分:0)
因为它首先被宣布,所以Eclubs控制器优先于Eclubs :: Members。而是声明Eclubs控制器的路线,例如。
namespace :eclubs do
resources :leaders, only: [:index, :show, :new, :create, :destroy]
resources :members, only: [:index, :show, :new, :create, :destroy]
end
resources :eclubs, except: [:show]