I just wrote a 3-part article on Rails STI here: http://joemcglynn.wordpress.com
-----Original Message----- From: [email protected] [mailto:[email protected]] On Behalf Of adrianb Sent: Friday, December 18, 2009 8:48 PM To: Ruby on Rails: Talk Subject: [Rails] Re: single table relation, newbee question On Dec 18, 7:18 am, jeb <[email protected]> wrote: > I am not sure if I shall use single table inheritance, or something > else. > > 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 @horse.mother.name > > 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. > > Thanks 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." -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

