问题陈述是创建命名路由。它应该生成一个类似 '/zombies/:name' 的路径,其中 :name 是一个参数,并指向 ZombiesController 中的索引操作。将路线命名为“墓地”
资源就是资源
zombies
id name graveyard
1 Ash Glen Haven Memorial Cemetary
2 Bob Chapel Hill Cemetary
3 Jim My Fathers Basement
我的解决方案是
TwitterForZombies::Application.routes.draw do
match ':name' => 'Zombies#index', :as => 'graveyard'
end
我也试过
TwitterForZombies::Application.routes.draw do
match ':name' => 'Zombie#index', :as => 'graveyard'
end
我在这两种情况下得到的错误是
Sorry, Try Again
Did not route to ZombiesController index action with :name parameter
我究竟做错了什么??