我是Rails的完全新手。
我已经创建了一个网络应用程序,可以通过/posts/123/comments/
或/posts/123/comments/new
进行访问,但我不知道如何在索引视图中使用link_to来显示具体的评论,当我尝试链接时,会出现“无路由”或“未定义符号”的错误。
在模型和routes.rb
中定义了帖子和评论之间的嵌套 have_many 关系,在执行 rake routes 时,post_comments GET /posts/:post_id/sensors(.:format)
comments#index
显示。
我该怎么做?
post_comment_path
未定义(在rake routes
中显示的路由是post_comments
,复数形式)。 - digitig