【发布时间】:2011-04-14 22:48:49
【问题描述】:
我正在关注http://guides.rubyonrails.org/getting_started.html 的指南
红宝石 1.9.2p0
Rails 3.0.0
但是当我尝试添加时,我被锁定在 6.2/6.3;
我收到错误消息(我将 Post 示例切换为 Specie);
Home#index 中的 ActionController::RoutingError 没有路线匹配 {:action=>"destroy", :controller=>"species"}
终端历史:
捆绑安装
耙分贝:创建
rails 生成控制器主页索引
rm public/index.html
rails 生成脚手架 Specie name:string latin:string
耙分贝:迁移
路径 localhost:3000/species/ 有效,但 localhost:3000/species/new 无效
耙路线:
species_index GET /species(.:format) {:action=>"index", :controller=>"species"}
物种索引 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=>"edit", :controller=>"species"}
物种 GET /species/:id(.:format) {:action=>"show", :controller=>"species"}
物种 PUT /species/:id(.:format) {:action=>"update", :controller=>"species"}
物种删除 /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
资源:物种
获取“主页/索引”
根 :to => "home#index"
【问题讨论】:
标签: ruby ruby-on-rails-3