single table relation, newbee question

I am not sure if I shall use single table inheritance, or something

I have a model called horses, in that I have the columns mother_id and
father_id where I of course intend to store the id of that horses
mother and father. By that information alone I want to create a
relation in the horses model for any horse to its mother and father. I
wish to write something like

I can't understand what to do with the type column in this case. This
should really be quite simple I guess.

Would appreciate some help.


Have a look at the guide on ActiveRecord Associations at and the magic of Rails will become
Also, if you have not already done so work through the Getting Started guide.


This is the problem that the relational database model was designed to
solve in the first place. I would recommend learning the basics of
database management if you don't yet have any background. Single-table
inheritance is a relatively new approach that developed out of object-
relational mapping.

Activerecord is magic when it comes to working with relations. I would
highly recommend Eldon Alameda's book "Foundation Rails 2."

I just wrote a 3-part article on Rails STI here: