The problem statement is Create a named route. It should generate a path like '/zombies/:name' where :name is a parameter, and points to the index action in ZombiesController. Name the route 'graveyard'
the resources are Resources
zombies
id name graveyard
1 Ash Glen Haven Memorial Cemetary
2 Bob Chapel Hill Cemetary
3 Jim My Fathers Basement
my solution is
TwitterForZombies::Application.routes.draw do
match ':name' => 'Zombies#index', :as => 'graveyard'
end
i also tried
TwitterForZombies::Application.routes.draw do
match ':name' => 'Zombie#index', :as => 'graveyard'
end
the error that i get in both cases is
Sorry, Try Again
Did not route to ZombiesController index action with :name parameter
What am i doing wrong??
Try this:
match '/zombies/:name',:to=> 'zombies#index', :as => 'graveyard'
RailsForZombies::Application.routes.draw do
resources :zombie
match '/zombies/:name',:to=> 'Zombies#index', :as => 'graveyard'
end
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With