我是一个完全新手在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