开发者

Link_to not working?

开发者 https://www.devze.com 2023-02-21 23:09 出处:网络
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.

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开发者_StackOverflow社区: 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"}


you can try

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


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

0

精彩评论

暂无评论...
验证码 换一张
取 消