简体   繁体   中英

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.

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

Do you have the line like this?

resources :zombies

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM