Ruby on rails 3 Rails路由中嵌套资源的问题

Ruby on rails 3 Rails路由中嵌套资源的问题,ruby-on-rails-3,Ruby On Rails 3,我正在尝试在我的routes配置中设置嵌套资源,但我无法找出问题所在 以下是我的路由配置中的相关代码 resources :positions, :only => [:new,:create,:edit,:update,:destroy] resources :etkh_profiles, :path => "members", :only => [:new,:create,:show,:index] do resources :positions collectio

我正在尝试在我的routes配置中设置嵌套资源,但我无法找出问题所在

以下是我的路由配置中的相关代码

resources :positions, :only => [:new,:create,:edit,:update,:destroy]

resources :etkh_profiles, :path => "members", :only => [:new,:create,:show,:index] do
  resources :positions
  collection do
    post 'search'
  end
end
当我尝试“/positions/new”时,它会起作用,但当我尝试“members/positions/new”时,会出现此错误

No route matches [GET] "/members/positions/new"
有什么想法吗?
谢谢您的帮助。

您需要使用的URL更像是
/members/:memberid/positions/new
,因为您已指定
位置
包含在
etkh_配置文件
中。您可以通过运行
rake routes
来检查这一点