Forum: Ruby on Rails acts_as_family_tree

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
M Daggett (Guest)
on 2006-02-02 03:55
(Received via mailing list)
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

--
Alex Y. (Guest)
on 2006-02-02 11:23
(Received via mailing list)
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?
M Daggett (Guest)
on 2006-02-02 18:16
(Received via mailing list)
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
>


--
Alex Y. (Guest)
on 2006-02-02 19:19
(Received via mailing list)
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.
This topic is locked and can not be replied to.