has_many 的 :dependent 选项和 delete

2017-05-07  本文已影响12人  FFCP

has_many:dependent 选项有两个方面的作用:

1. Controls what happens to the associated objects when their owner is destroyed:

2. :dependent 选项的取值影响 delete / clear 方法的行为:

上一篇 下一篇

猜你喜欢

热点阅读