Rails3路由错误.没有路线匹配{:action =>"destroy"

Oll*_*lle 2 ruby ruby-on-rails-3

我正在关注http://guides.rubyonrails.org/getting_started.html上的指南

Ruby 1.9.2p0
Rails 3.0.0

但当我尝试添加时,我被锁定在6.2/6.3.

我收到错误(我将Post示例切换为Specie);

ActionController :: HomeError中的RoutingError索引没有路由匹配{:action =>"destroy",:controller =>"species"}

终端历史:

bundle install
rake db:create
rails generate controller home index
rm public/index.html
rails generate scaffold Specie name:string latin:string
rake db:migrate

路径localhost:3000 /物种/工作但不是localhost:3000 /物种/新

耙路线:

species_index GET /species(.:format) {:action =>"index",:controller =>"species"}
species_index POST /species(.:format) {:action =>"create",:controller =>"species" "}
new_species GET /species/new(.:format) {:action =>"new",:controller =>"species"}
edit_species GET /species/:id/edit(.:format) {:action =>"编辑",:controller =>"种类"}
种类GET /species/:id(.:format){:action =>"show",:controller =>"species"}
种类PUT/species /:id(:格式){:action =>"update",:controller =>"species"}
种DELETE /species/:id(.:format){:action =>"destroy",:controller =>"species"}
home_index GET /home/index(.:format) {:controller =>"home",:action =>"index"}
root /(.:format) {:controller =>"home",:action =>"index"}

的routes.rb

资源:物种
获得"home/index"
root:to =>"home #index"

mač*_*ček 10

你的问题是复数speciesspecies(它们是相同的).

答案就在你的身上rake routes.请注意,您将要使用:

<%= link_to "All Species", species_index_path %>
Run Code Online (Sandbox Code Playgroud)

有关详细信息,请参阅"路由"指南中的第4.8节"覆盖单数形式 ".