在我的应用程序中,一个用户有很多帖子,一个帖子有很多评论。如何配置路由?我将其配置如下:
resources :users do
resources :post do
resources :comments
end
end
一些文章说,不推荐这样做,因为它会让人感到困惑。
发布于 2013-03-03 21:55:13
您应该使用如下所示的内容
resources :users do
resources :posts
end
resources : posts do
resources :comments
end
因为深度嵌套会产生一些问题,比如rails中的长路径名和urls中的长urls。
https://stackoverflow.com/questions/15178000
复制相似问题