上下文
Category
有许多Products
,并且Category
产品模型中设置了依赖性销毁。
第一种情况:
c = Category.last
c.destroy
c => record persists as expected because it is already loaded in c variable
第二种情况:
p = Category.last.products
Category.last.destory
p => records persisted as expected in p variable as already loaded in this.
第三种情况:
c = Category.last
p = c.products
c.destroy
p => [] .. Why??
c => record persisted as expected in c variable
在第三种情况下,为什么我得到p变量的空白数组?
参考SS。doubt_file