jim
jim

Reputation: 9138

Ruby on Rails link_to undefined method

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.

Upvotes: 0

Views: 2161

Answers (1)

Phyo Wai Win
Phyo Wai Win

Reputation: 1160

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

Do you have the line like this?

resources :zombies

Upvotes: 2

Related Questions