# :dependent =\> :destroy vs ON DELETE CASCADE

**URL:** <https://www.ruby-forum.com/t/dependent-destroy-vs-on-delete-cascade/87296>\
**Category:** Rails\
**Created:** [March 1, 2007, 3:11pm UTC](https://www.ruby-forum.com/t/dependent-destroy-vs-on-delete-cascade/87296 "2007-03-01T15:11:38Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![suer\_rick](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/bc8723/32.png) [@suer\_rick](https://www.ruby-forum.com/u/suer_rick)\
**Post date:** [March 1, 2007, 3:11pm UTC](https://www.ruby-forum.com/t/dependent-destroy-vs-on-delete-cascade/87296/1 "2007-03-01T15:11:38Z")

</div>

Sorry if I missed this in the docs somewhere.

My guess is that if I use :dependent =\> :destroy, then the application  
sends commands to the db to destroy the dependent records.

If I am using a database that supports FKs and ON DELETE CASCADE, then  
is there any point in using :dependent =\> :destroy ?

---

<div class="post-metadata">

**Author:** ![suer\_rick](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/bc8723/32.png) [@suer\_rick](https://www.ruby-forum.com/u/suer_rick)\
**Post date:** [March 1, 2007, 3:23pm UTC](https://www.ruby-forum.com/t/dependent-destroy-vs-on-delete-cascade/87296/2 "2007-03-01T15:23:39Z")

</div>

Hi Rick,

Rick S. wrote:

> If I am using a database that supports FKs and  
> ON DELETE CASCADE, then is there any point  
> in using :dependent =\> :destroy ?

I think the point is in being able to keep that logic in the application  
itself, rather than having to go to two seperate code bases to find out  
what  
the result of an Object.destroy will be.

Just my $.02

Best regards,  
Bill
