从文档中,以下编辑和更新路径将类似于/ comments /:id

resources :articles do
  resources :comments, shallow: true
end

当我更新评论并且它不知道文章时你如何回到评论索引?在这种情况下你会回到文章索引吗?

在使用浅嵌套更新注释后,是否有可接受的工作来回到注释列表?

更新我的模型使用has_and_belongs_to_many关联,所以我不能做@ comment.article来获取父级 .

我的模特

class Venue < ApplicationRecord
  has_and_belongs_to_many :users
end

class User < ApplicationRecord
  has_and_belongs_to_many :venues
end

我的路线

resources :venues do
      resources :accounts, shallow: true
end