如果有的话:embeds_many :foos。
是否需要:dependent => :destroy?或者,如果我销毁了父元素。是否将自动删除所有相应的foos?
我尝试在控制台上检查Foo,但得到:
Mongoid::Errors::InvalidCollection: Access to the collection for Foo is not allowed since it is an embedded document, please access a collection from the root document.发布于 2012-04-25 20:15:29
不能直接访问嵌入的文档。包含在上级单据中,只能通过上级访问。销毁父文档时,嵌入的文档也会随之删除,但是如果您有任何特定于销毁嵌入文档的回调,您应该看看cascade_callbaks。
https://stackoverflow.com/questions/10307584
复制相似问题