Take the 2-minute tour ×

The objective is to create a custom route so that /undead will go to the undead action on the ZombiesController.

My code:

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

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

I'm not sure where i went wrong....

share|improve this question
add comment

4 Answers

up vote 8 down vote accepted

Your route notation should look like this:

match 'path' => 'controller#action'

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

match 'undead' => 'zombies#undead'
share|improve this answer
in the video the match example is match 'new_tweet' => "Tweets#new" My question is why 'zombies#undead' instead of 'Zombies#undead' thank you in advance –  juanitofatas Apr 9 '12 at 15:05
According to the Rails Guides, the convention is to express the controller in lowercase. –  Ryan Atallah Aug 27 '12 at 5:19
Thank you for your answer –  juanitofatas Oct 11 '12 at 1:12
they should really fix this, following their example this was really unclear... –  andrhamm Jul 19 '13 at 13:33
add comment

/undead goes to undead action

match 'undead' => 'zombies#undead'

You could replace match by one of get, post, put, or delete.

share|improve this answer
add comment

I think the question is changed now, solution is :

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

share|improve this answer
add comment

Read the objetive again :)

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

share|improve this answer
add comment

Your Answer


