Matt Darby
Matt Darby

Reputation: 6324

Link_to not working?

Alright, either I need to go to bed or change careers. An incredibly simple link_to is failing and I just can't see where.

#routes.rb
resources :wikis

#view.html.haml
= link_to @wiki.title, wiki_path(@wiki)

Errors with:

No route matches {:action=>"show", :controller=>"wikis", :id=>#<Wiki id: 10, created_by_id: 1, ...

Now I'm not doing anything crazy like overriding the primary key; anything.

Here's the associated Wikis#show route in rake routes:

wiki GET    /wikis/:id(.:format)                            {:action=>"show", :controller=>"wikis"}

Upvotes: 1

Views: 429

Answers (2)

Sergey K
Sergey K

Reputation: 5107

you can try

<%= link_to @wiki.title, @wiki %>

Upvotes: 2

Adrien Rey-Jarthon
Adrien Rey-Jarthon

Reputation: 1174

does it works: wiki_path(@wiki.id) ?

Upvotes: 1

Related Questions