# New to Ruby on Rails.. Database Relations?

**URL:** <https://www.ruby-forum.com/t/new-to-ruby-on-rails-database-relations/90640>\
**Category:** Rails\
**Created:** [March 30, 2007, 4:56pm UTC](https://www.ruby-forum.com/t/new-to-ruby-on-rails-database-relations/90640 "2007-03-30T16:56:54Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Nakirema](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/n/bb73d2/32.png) [@Nakirema](https://www.ruby-forum.com/u/Nakirema)\
**Post date:** [March 30, 2007, 4:56pm UTC](https://www.ruby-forum.com/t/new-to-ruby-on-rails-database-relations/90640/1 "2007-03-30T16:56:54Z")

</div>

I’ve been devloping in Coldfusion for the last 3-4 years… I’m looking  
into Ruby on Rails and was wonding how I can join tables in my database.  
Also, if I delete a Ex. Post, how can I make sure it deletes the  
comments…?

Thank in Advance…

I’m sure it something easy, just lost in a new world…

---

<div class="post-metadata">

**Author:** ![Nakirema](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/n/bb73d2/32.png) [@Nakirema](https://www.ruby-forum.com/u/Nakirema)\
**Post date:** [March 30, 2007, 5:02pm UTC](https://www.ruby-forum.com/t/new-to-ruby-on-rails-database-relations/90640/2 "2007-03-30T17:02:49Z")

</div>

> I’ve been devloping in Coldfusion for the last 3-4 years…  
> I’m looking into Ruby on Rails and was wonding how I can join  
> tables in my database.

Look at the :includes option for the finder methods of  
ActiveRecord::Base.

Alternately, you can always invoke manual SQL queries with find\_by\_sql.

> Also, if I delete a Ex. Post, how can I make sure it deletes  
> the comments…?

See :dependent=\>:destroy in ActiveRecord::Base to do it in rails; you  
could also tell your database to do it on\_delete if your database  
permits.

- donald

---

<div class="post-metadata">

**Author:** ![Nakirema](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/n/bb73d2/32.png) [@Nakirema](https://www.ruby-forum.com/u/Nakirema)\
**Post date:** [March 30, 2007, 5:13pm UTC](https://www.ruby-forum.com/t/new-to-ruby-on-rails-database-relations/90640/3 "2007-03-30T17:13:43Z")

</div>

Ball, Donald A Jr (Library) wrote:

> > I’ve been devloping in Coldfusion for the last 3-4 years…  
> > I’m looking into Ruby on Rails and was wonding how I can join  
> > tables in my database.
> 
> Look at the :includes option for the finder methods of  
> ActiveRecord::Base.
> 
> Alternately, you can always invoke manual SQL queries with find\_by\_sql.
> 
> > Also, if I delete a Ex. Post, how can I make sure it deletes  
> > the comments…?
> 
> See :dependent=\>:destroy in ActiveRecord::Base to do it in rails; you  
> could also tell your database to do it on\_delete if your database  
> permits.
> 
> - donald

Ok, I should have specified… I’m really new! I did not understand  
anything you just said… Obviously I need to look into the ruby  
language…
