I am building a family tree website for a client where they will be able to add and remove people from the tree that spans many generations. Right now I am using a single Relation model to represent relationships between people. It has an originating_person_id and a target_person_id, which allows me to have add_spouse and add_child method on Person.
I have a lot of duplicated code with two relation types in the one model. I also can only add children to a single person, which then breaks if the person has children with multiple people.
I think I want to have a Person.marriages method that returns spouse and children, as well as a Person.children method that will return children from all marriages.
What is the best way to achieve this? I realise there is a genealogy gem but I am kind of committed to doing this on my own now.