我是一個完全新手在Rails中。如何使用Link_to與嵌套資源
我已經創建了一個Web應用程序,我可以通過/posts/123/comments/
或/posts/123/comments/new
訪問,但我不知道如何使用的link_to在索引視圖來顯示具體的評論,當我嘗試連接它,會出現「無路由「或」未定義符號「。
我在模型中定義的帖子和評論之間有嵌套的have_many關係,並且在我執行rake路由時出現routes.rb
和post_comments GET /posts/:post_id/sensors(.:format)
comments#index
。
我該怎麼做?
你試過'link_to'show',[@post,comment]'? – toch 2013-05-02 07:54:04