Ruby on rails 轨道路线不匹配';新';具有RESTFul路由的模式

Ruby on rails 轨道路线不匹配';新';具有RESTFul路由的模式,ruby-on-rails,ruby-on-rails-3,rest,mongoid,url-routing,Ruby On Rails,Ruby On Rails 3,Rest,Mongoid,Url Routing,我得到了这个错误: No route matches {:action=>"show", :controller=>"video_publications", :campaign_id=[...] 使用此url: /campaigns/514be3834413790249000025/video_publications/new 我有这样的路线: resources :campaigns do resources :video_publications end 我在重定向

我得到了这个错误:

No route matches {:action=>"show", :controller=>"video_publications", :campaign_id=[...]
使用此url:

/campaigns/514be3834413790249000025/video_publications/new
我有这样的路线:

resources :campaigns do
   resources :video_publications
end
我在重定向到以下位置时出错:

new_campaign_video_publication_path(@campaign)
我很困惑,有什么想法吗

使用:

  • 轨道3.2.11
  • Mongoid 3.0.23

在routes.rb中添加这行代码

match 'campaigns/:id/video_publications/new' => 'campaigns/video_publications/new',:as => :new_campaign_video_publication

错误不在
new
路径中,而是在
show
操作中

它抱怨:

:action=>"show", :controller=>"video_publications"
在代码中,将“显示操作”的部分代码更改为以下内容:

<%= link_to 'Show', campaign_video_publication_path(@campaign, @publication) %>


我已经回答了下面的问题,但是你可以将你的
new.html.erb
\u form.html.erb
代码粘贴到这里,只是为了看看。这不会有任何效果。首先,路线的定义是正确的。此外,代码将无法正常工作,使用匹配器是不可取的是的,就是这样!谢谢有点混淆了这个路由错误,您希望路由出现问题。rb不是您的查看代码。是的,有点:)我很高兴它有帮助:)