# Join Association Destroy

**URL:** <https://www.ruby-forum.com/t/join-association-destroy/142614>\
**Category:** Rails\
**Created:** [July 9, 2008, 6:07pm UTC](https://www.ruby-forum.com/t/join-association-destroy/142614 "2008-07-09T18:07:47Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Jorg\_L](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/76d3ee/32.png) [@Jorg\_L](https://www.ruby-forum.com/u/Jorg_L)\
**Post date:** [July 9, 2008, 6:07pm UTC](https://www.ruby-forum.com/t/join-association-destroy/142614/1 "2008-07-09T18:07:47Z")

</div>

In the future will Active Record delete the child records in an  
association when the parents are deleted? Certainly one can add code  
in the controller or the database to take care of avoiding orphans but  
it really seems like it should be part of the framework.

---

<div class="post-metadata">

**Author:** ![Jorg\_L](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/76d3ee/32.png) [@Jorg\_L](https://www.ruby-forum.com/u/Jorg_L)\
**Post date:** [July 9, 2008, 6:18pm UTC](https://www.ruby-forum.com/t/join-association-destroy/142614/2 "2008-07-09T18:18:20Z")

</div>

well… it is built in.

class User \< ActiveRecord::Base  
has\_many :projects, :dependent =\> :destroy  
end

See ActiveRecord::Associations docs for more.

---

<div class="post-metadata">

**Author:** ![Jorg\_L](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/76d3ee/32.png) [@Jorg\_L](https://www.ruby-forum.com/u/Jorg_L)\
**Post date:** [July 9, 2008, 6:27pm UTC](https://www.ruby-forum.com/t/join-association-destroy/142614/3 "2008-07-09T18:27:42Z")

</div>

Ahh thanks. There’s too much information in the api when you’re not  
sure what you’re looking for.
