【发布时间】:2013-04-29 11:31:03
【问题描述】:
我是 Rails 的新手。
我创建了一个 Web 应用程序,我可以通过 /posts/123/comments/ 或 /posts/123/comments/new 访问,但我不知道如何在索引视图中使用 link_to 来显示具体评论,当我尝试链接它时,出现“没有路线”或“未定义的符号”。
我在模型和routes.rb 和post_comments GET /posts/:post_id/sensors(.:format) 中定义的帖子和cmets 之间存在嵌套的have_many 关系,当我执行rake 路由时会出现comments#index。
我该怎么做?
【问题讨论】:
标签: ruby-on-rails ruby ruby-on-rails-3 nested-resources