Acts_as_family_tree


#1

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


#2

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 Y. removed_email_address@domain.invalid wrote:


Alex


Rails mailing list
removed_email_address@domain.invalid
http://lists.rubyonrails.org/mailman/listinfo/rails


#3

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.


#4

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?