好得很程序员自学网

<tfoot draggable='sEl'></tfoot>

rails 级联删除

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  =>  :destroy   

2008-10-30 11:27:11-- 回复文章

查看更多关于rails 级联删除的详细内容...

  阅读:49次