I am trying to model families in a database for tax and other purposes, and am probably trying to hard. I setup a people table and a base class person with name, address, date of birth,etc. Then I create classes of husbands,wives, children that are all of the person class, and all are mapped onto the single people table. obviously these are self-referencing tables, but I having trouble with the has_many, belongs_to relationships. I think I am confusing rails to some degree. It would seem that these would be easy to model, but being a part-time programmer, I am having troubles. when I use the has_many (for children) and has_one (for husband,wife) I cannot get rails to consistently persist those relationships. I'm also using different names for the relationship than the class (i.e. belongs_to :father, :class_name => "Husband", foreign_key => "father"). I realize that I don't have a full handle on how to do this more simply. (or how not to confuse rails). can anybody point me in the right direction?
on 2007-04-19 17:59