For a project that I am working on I need to have a family tree. This means that instead of having one parent each item has at most two. As far as I know acts_as_tree only allows one parent_id. Any suggestions on how to make a "acts_as_family_tree" ? Thanks, Mark -- -------------------------------------------------------------------- I am Mark Daggett and I approve this message.
M Daggett wrote:> For a project that I am working on I need to have a family tree. This > means that instead of having one parent each item has at most two. As > far as I know acts_as_tree only allows one parent_id. Any suggestions > on how to make a "acts_as_family_tree" ?Better to HABTM onto the item table, surely? That way there''s no problem expanding out to adoptive and natural parents, step-parents, and so on? -- Alex
Hi Alex, Yes, I have HATBM right now but I was hoping to leverage off of the acts_as_tree helper methods like node.ancestors, node.siblings, node.children etc. I don''t think it would be that bad to extend acts_as_tree to work as a family tree as well. If I find a nicely encapsulated solution I''ll release it as a plugin too. Mark On 2/2/06, Alex Young <alex@blackkettle.org> wrote:> M Daggett wrote: > > For a project that I am working on I need to have a family tree. This > > means that instead of having one parent each item has at most two. As > > far as I know acts_as_tree only allows one parent_id. Any suggestions > > on how to make a "acts_as_family_tree" ? > Better to HABTM onto the item table, surely? That way there''s no > problem expanding out to adoptive and natural parents, step-parents, and > so on? > > > -- > Alex > _______________________________________________ > Rails mailing list > Rails@lists.rubyonrails.org > http://lists.rubyonrails.org/mailman/listinfo/rails >-- -------------------------------------------------------------------- I am Mark Daggett and I approve this message.
M Daggett wrote:> Hi Alex, > Yes, I have HATBM right now but I was hoping to leverage off of the > acts_as_tree helper methods like node.ancestors, node.siblings, > node.children etc. I don''t think it would be that bad to extend > acts_as_tree to work as a family tree as well. If I find a nicely > encapsulated solution I''ll release it as a plugin too. >Please do! I''d be intrigued. -- Alex