0

I'm following the Twitter for Zombies tutorial and i'm having trouble getting the link_to method to work.

In my Tweet controller I have:

@tweet = tweet.find(params['id']);

In my view i've tried the following:

<%= link_to @tweet.zombie.name, @tweet.zombie %>
<%= link_to @tweet.zombie.name, zombie_path(@tweet.zombie) %>

But I keep getting the error:

undefined method `zombie_path' for #<#<Class:0xab1fd00>:0xa1d5d80>

Any ideas whats up with this? Thanks.

3
  • Does it say for which line it's erroring out on? Is it for the first or second link_to? Commented Feb 16, 2012 at 17:01
  • I only have one link_to call. It's showing an error on that line. Commented Feb 16, 2012 at 17:18
  • Oh I see. Sorry I skimmed over the part you saying you've tried the following. I thought you meant you currently had that in there. Commented Feb 16, 2012 at 17:28

1 Answer 1

2

What's in your routes.rb file? Please show us.

Do you have the line like this?

resources :zombies
Sign up to request clarification or add additional context in comments.

1 Comment

This was the problem. I was missing that line. Thanks :)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.