【发布时间】:2016-06-23 14:29:36
【问题描述】:
我不知道如何在资源 do 方法中设置超过 1 个“项目”。我有 3 个脚手架,即 Post、Comment、Response。我想在 rake 路线中达到这一点:'new_post_comment_response => /posts/id/comment/id/response/new'
关系是:
'发布模型 有很多 :cmets 有很多:responses
评论模型 有很多 :responses 属于_to :post
响应模型 属于_to :post 属于_to :comment'
在 routes.rb 我设置了:
资源:帖子做 资源 :cmets,除了:[:show, :index] 结束
资源 :cmets 做 资源 :responses,除了:[:show, :index] 结束
但我想在 rake 路由中包含三个项目,因为我要做一些“论坛中的三个响应(Post-Comment-Response-to-comment)”。你知道我的意思吗?
所以,我的问题是:如何设置资源和控制器来检测 Post 和 Comment ID,以及如何设置资源。
感谢您的帮助!
【问题讨论】: