小编fuc*_*uco的帖子

如何将Link_to与嵌套资源一起使用

我是Rails的新手.

我创建了一个Web应用程序,我可以通过/posts/123/comments/或访问/posts/123/comments/new,但我不知道如何在索引视图中使用link_to来显示具体的注释,当我尝试链接它时,出现"无路由"或"未定义的符号" .

我在模型和定义的文章和评论之间的嵌套关系have_many routes.rbpost_comments GET /posts/:post_id/sensors(.:format) comments#index当我执行耙路线出现.

我怎么能这样做?

ruby ruby-on-rails nested-resources ruby-on-rails-3

11
推荐指数
2
解决办法
8865
查看次数