Ruby on rails 为什么我会得到;您可能有不明确的路线”;对于rails控制器操作?

Ruby on rails 为什么我会得到;您可能有不明确的路线”;对于rails控制器操作?,ruby-on-rails,ruby,routing,formtastic,Ruby On Rails,Ruby,Routing,Formtastic,我的一个模型的语义形式有问题。相关模型如下: class Event < ActiveRecord::Base belongs_to :series ... end class Series < ActiveRecord::Base has_many :events ... end 编辑:我已经运行了rake routes | grep series | grep new来查找冲突的路由,但没有,以下是输出: new_series_event GET /serie

我的一个模型的语义形式有问题。相关模型如下:

class Event < ActiveRecord::Base
  belongs_to :series
  ...
end

class Series < ActiveRecord::Base
  has_many :events
  ...
end
编辑:我已经运行了
rake routes | grep series | grep new
来查找冲突的路由,但没有,以下是输出:

new_series_event GET /series/:series_id/events/new(.:format) {:controller=>"events", :action=>"new"} 
new_series       GET /series/new(.:format) {:controller=>"series", :action=>"new"}
/series/new
对应的模板呈现以下部分内容:

<% semantic_form_for(@series) do |f| %>
  <%= f.error_messages %>
  <% f.inputs do %>
    <%= f.input :title %>
    <%= f.input :uri, :label => "URL of the Series", :hint => "For example, use 'tes' for 'Transportation Education Series'. It will appear as http://events.kittelson.com/tes"    <%= f.input :description %>
    <%= f.input :contact, :label => "Contact email" %>
    <%= f.input :color, :label => "Pick a dark color" %>
  <% end %>
  <% f.buttons do %>
    <%= f.commit_button %>
    <%= link_to "or cancel", :back %>
  <% end %>
<% end %>

是什么导致了这个路由错误?

只是一种预感。你可能混淆了Rail的拐点。也许它应该是
属于串行
而不是
属于串行


你看,通常我们会写
属于用户
而不是
用户
。所以你可能想试试看。

只是一种预感。你可能混淆了Rail的拐点。也许它应该是
属于串行
而不是
属于串行


你看,通常我们会写
属于用户
而不是
用户
。因此,您可能想尝试一下。

是否运行类似于
rake routes | grep series | grep new
的程序来查找冲突的路由?是的,没有冲突的路由:
new_series_event GET/series/:series_id/events/new(:format){:controller=>“events”,“action=>“new”}new_series GET/series/new(:format){:controller=>“series”,:action=>“new”}
我已经在问题中添加了信息,它在“EDIT”下接近开始。您是否运行类似于
rake routes | grep series | grep new
的程序来查找冲突的路由?是的,没有冲突的路径:
new\u series\u event GET/series/:series\u id/events/new(:format){:controller=>“events”,:action=>“new”}new\u series GET/series/new(:format){:controller=>“series”,:action=>“new”}
我已经将信息添加到了问题中,它就在“编辑”下面的开始处。好主意,但事实并非如此,拐点将“serial”映射为“serials”,将“series”映射为“series”,并将“series”映射为复数形式。实际上,你的直觉是正确的。建议使用config.routes中的
:singular
选项进行更改,使单数版本成为一个独特的单词。成功了,它消除了“模糊路线”错误。耶!我以前不知道单数期权。谢谢好主意,但事实并非如此,拐点将“序列”映射为“序列”,将“序列”映射为“序列”作为复数。事实上,你的直觉是正确的。建议使用config.routes中的
:singular
选项进行更改,使单数版本成为一个独特的单词。成功了,它消除了“模糊路线”错误。耶!我以前不知道单数期权。谢谢
<% semantic_form_for(@series) do |f| %>
  <%= f.error_messages %>
  <% f.inputs do %>
    <%= f.input :title %>
    <%= f.input :uri, :label => "URL of the Series", :hint => "For example, use 'tes' for 'Transportation Education Series'. It will appear as http://events.kittelson.com/tes"    <%= f.input :description %>
    <%= f.input :contact, :label => "Contact email" %>
    <%= f.input :color, :label => "Pick a dark color" %>
  <% end %>
  <% f.buttons do %>
    <%= f.commit_button %>
    <%= link_to "or cancel", :back %>
  <% end %>
<% end %>
ActionController::Routing::Routes.draw do |map|
  map.resources :series, :has_many => :events
  map.resources :events, :has_many  => :rsvps
end