You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
How would one go about setting up a the association to model a human (or any organic) family tree, where each node has two parents? Is this possible with closure_tree?
I have a Human class and in my initial setup (with a simple self join) I had:
This works, in that a human can have human.mother and human.father and both mother and father can call .offspring
But obv this setup will become horribly inefficient when trying to draw large family trees, so I'm looking to see if closure_tree could help.
If I add to my existing Human model
has_closure_treeparent_column_name: :father_id
Then closure_tree works for the paternal line. But how would I set about adding a maternal line?
I optimistically tried adding has_closure_tree parent_column_name: :mother_id after the first has_closure_tree but that (not surprisingly) didn't work.
Is having multiple parents possible with closure_tree? If not, is there a standard, conventional way to approach this sort of problem?
The text was updated successfully, but these errors were encountered:
How would one go about setting up a the association to model a human (or any organic) family tree, where each node has two parents? Is this possible with closure_tree?
I have a Human class and in my initial setup (with a simple self join) I had:
This works, in that a
human
can havehuman.mother
andhuman.father
and both mother and father can call.offspring
But obv this setup will become horribly inefficient when trying to draw large family trees, so I'm looking to see if closure_tree could help.
If I add to my existing Human model
Then closure_tree works for the paternal line. But how would I set about adding a maternal line?
I optimistically tried adding
has_closure_tree parent_column_name: :mother_id
after the firsthas_closure_tree
but that (not surprisingly) didn't work.Is having multiple parents possible with closure_tree? If not, is there a standard, conventional way to approach this sort of problem?
The text was updated successfully, but these errors were encountered: