Rails for Zombie Level 5 Challenge 2 - Custom Routes

The goal is to create your own route so that / undead transitions to undead on the ZombiesController.

My code is:

TwitterForZombies::Application.routes.draw do
    resources :zombies 
    match 'show_zombie' => "undead#show" 
end

And the error ... "I did not add the correct route, I could not get to ZombiesController # undead."

I'm not sure where I made a mistake ....

+3
source share
4 answers

Your route designator should look like this:

match 'path' => 'controller#action'

So, the path is undead, the controller is zombie, and the action is undead:

match 'undead' => 'zombies#undead'
+8
source

/ undead switches to undead action

match 'undead' => 'zombies#undead'

You can replace matchwith one of get, post, put, or delete.

+1
source

, , :

RailsForZombies:: Application.routes.draw do
'undead' = > 'Zombies # undead'

+1
source

Read the object again :)

You want to get into ZombiesController # undead, but you set it to go to ZombiesController # show

0
source

All Articles