大家每天都有一个好心情 :)
rails cascade 级联删除[ruby]
用一次忘记一次,记下来。
:dependent - if set to :destroy all the associated objects are destroyed alongside this object by calling their destroy method. If set to :delete_all all associated objects are deleted without calling their destroy method. If set to :nullify all associated objects’ foreign keys are set to NULL without calling their save callbacks.
- belongs_to :xxx
- has_many :xxxxs , :foreign_key => :xxxx_id , :dependent => :destroy
- has_many :xxxxs, :dependent => :destroy
2008-10-30 11:27:11--回复文章