rails 级联删除
大家每天都有一个好心情 :)
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.
view plain print ?
belongs_to :xxx has_many :xxxxs , :foreign_key => :xxxx_id , :dependent => :destroy has_many :xxxxs , :dependent => :destroy2008-10-30 11:27:11-- 回复文章
声明:本文来自网络,不代表【好得很程序员自学网】立场,转载请注明出处:http://www.haodehen.cn/did43596