我跟着导游走,started.html
Ruby 1.9.2p0
Rails 3.0.0
但我被锁定在6.2/6.3,当我试图添加;
我得到了错误(我将Post示例切换为the );
操作控制器::Home#index中的路由错误没有路由匹配{:action=>“破坏”,:controller=>“物种”}
终点站历史:
捆绑安装 rake db:创建 rails生成控制器主索引 rm public/index.html rails生成脚手架名称:string拉丁文:string rake db:迁移
路径本地宿主:3000/物种/工作,但不是本地宿主:3000/物种/新
耙路:
species_index GET /species(.:format) {:action=>"index",:controller=>"species"} species_index POST /species(.:format) {:action=>“创建”,:controller=>“物种”} new_species GET /物种/新(.:format){:action=>“新”,:controller=>“物种”} edit_species获取/物种/:id/编辑(.:format){:action=>“编辑”,:controller=>“物种”} 物种获取/物种/:id(.:format){:action=>“显示”,:controller=>“物种”} 物种放置/物种/:id(.:format){:action=>“更新”,:controller=>“物种”} 物种删除/物种/:id(.:format){:action=>“破坏”,:controller=>“物种”} home_index GET /home/index(.:format) {:controller=>"home",:action=>"index"} 根/(.:format) {:controller=>"home",:action=>"index"}
routes.rb
资源:物种 得到“家/索引” 根:转到=> "home#index“
发布于 2010-09-21 00:33:05
您的问题是,species的复数是species (它们是相同的)。
答案在你的rake routes里。请注意,您需要使用:
<%= link_to "All Species", species_index_path %>有关更多信息,请参见路由指南中的第4.8节-覆盖单一形式。
https://stackoverflow.com/questions/3756259
复制相似问题