Your input/experience appreciated. I have noticed multiple
discussions regarding husband and wife. But none really end in a
“this is a the best way to handle things.” Here is my situation. I’m
recording information on couples – husband and wife, one of each. If
the two are no longer married, the couple will evaporate. If either
person is deleted, then couple will evaporate. I originally thought
of having all individuals in one table, persons, and then creating
couple with alink to each person.
== Schema Information
Schema version: 20100620123354
Table name: couples
id :integer not null, primary key
active :boolean
husband_id :integer # reference to persons table
wife_id :integer # reference to persons table
I was then thinking:
belongs_to :husband,:class_name=>“Person”,:foreign_key=>“husband_id”
belongs_to :wife,:class_name=>“Person”,:foreign_key=>“wife_id”
and then having classes “Husband < Person” and “Wife < Person”. Is
this feasible?
I am so torn I don’t know what step to take next. I’m early in
development so I can do anything. But what I want to do is what is
best.
Do I stick with a couples table and one persons table?
Do I create separate tables for husbands and wives? If I do this, can
I create one Person class and Husband & Wife models inheriting
Person…that way the two tables are created and migrated
separately?
You input is really appreciated.
dvn