# Newb question regarding activerecord relationships

**URL:** <https://www.ruby-forum.com/t/newb-question-regarding-activerecord-relationships/130847>\
**Category:** Rails\
**Created:** [March 3, 2008, 9:59pm UTC](https://www.ruby-forum.com/t/newb-question-regarding-activerecord-relationships/130847 "2008-03-03T21:59:55Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![nateleavitt](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/n/3bc359/32.png) [@nateleavitt](https://www.ruby-forum.com/u/nateleavitt)\
**Post date:** [March 3, 2008, 9:59pm UTC](https://www.ruby-forum.com/t/newb-question-regarding-activerecord-relationships/130847/1 "2008-03-03T21:59:55Z")

</div>

Hi Guys,  
I’ve tried searching for this, but haven’t come up with the answers.  
Sorry, this is a basic question, so sorry for the newb-ness.

Ok so I’m putting together a ruby report that uses ActiveRecord. I  
will explain some details below:

So I have an Payment object which inherits from ActiveRecord:  
Payment  
belongs to invoice  
id, invoice\_id, amt, date, type

Then I have 3 payment types; Initial, Recur, and Refund that inherit  
from Payment. The only differences are that each overrides the type  
field.

So my question is this the correct way in setting this up… with only  
a payments table with a type field?

I essentially want to do this: Initial.find(:all) and it will pull all  
payments with type Initial… instead of doing  
Payment.find(:all, :conditions…)

Thanks.

---

<div class="post-metadata">

**Author:** ![nateleavitt](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/n/3bc359/32.png) [@nateleavitt](https://www.ruby-forum.com/u/nateleavitt)\
**Post date:** [March 3, 2008, 11:59pm UTC](https://www.ruby-forum.com/t/newb-question-regarding-activerecord-relationships/130847/2 "2008-03-03T23:59:44Z")

</div>

Nevermind… found what I need to search for. STI (Single Table  
Inheritance).

Thanks!
