2010-09-20 138 views
2

我在之后的指南,http://guides.rubyonrails.org/getting_started.htmlRails3路由错误。没有路由匹配{:动作=> “消灭”

红宝石1.9.2p0
的Rails 3.0.0

但我在6.2/6.3锁定,当我尝试添加;

我得到的错误(I切换邮政例如硬币);

的ActionController :: RoutingError主页#指数 没有路由匹配{:动作=> “消灭”,:控制器=> “种”}

终端的历史:

捆绑安装
rake db:create
rails generate controller home index
rm public/index.html
个轨生成脚手架正金的名字:串拉丁文:字符串
耙分贝:迁移

路径本地主机:3000 /物种/工程,但不是localhost:3000 /品种/新

耙路线:

species_index GET /species(.:format){:行动=> “索引”,:控制器=> “物种”}
species_index POST /species(.:format){:行动=> “创建”, :controller =>“species”}
new_species GET /species/new(.:format){:action =>“new”,:controller =>“species”}
edit_species GET /species/:id/edit(.:format){:action => “编辑”,:控制器=>“种类”}
种类GET /物种/:id(.:format){:action =>“show”,:controller =>“species”}
种类PUT/:id(。:format){:action =>“update”,:controller =>“species”}
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

资源:种
GET “家/索引”
根:到=> “回家#指数”

回答

10

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

答案在rake routes。请注意,您需要使用:

<%= link_to "All Species", species_index_path %> 

请参阅路由指南中的Section 4.8 - Overriding The Singular Form了解更多信息。

+0

感谢您抽出时间,真的很感激。 – Olle 2010-09-21 17:24:21

相关问题