2 or more parents, child

Hello,

Here’s what I hope to accomplish:

A task may have 0,1, or more parent tasks - for example, a task may be
top-level, or a simple sub-task (1 parent), or a multi-purpose task
(e.g.
setting up automatic backup of the svn repository benefits both projectA
and
projectB [note that I’m treating projects as tasks, just bigger ones
with
more children]).

It may be relatively rare for a task to have more than one parent, so
I’m
not sure I want to complicate the entire system because of that. For
example I might use a simple parent-child approach for tasks and then
have a
“tasks_tasks” table to record supplemental parent-child relationships.
Alternatively, I could just use “tasks_tasks” to include all such
relationships (and perhaps others, e.g. dependencies).

Any thoughts, guidance?

Thanks!

Marc

Check out acts_as_graph, it’ll handle multiple parents.

http://blog.tammersaleh.com/pages/acts_as_graph

On 8/31/07, Marc B. [email protected] wrote:

Marc


Joshua B.
http://www.linkedin.com/in/joshuabates

Joshua B. wrote:

Check out acts_as_graph, it’ll handle multiple parents.

http://blog.tammersaleh.com/pages/acts_as_graph

That’s a really good solution for what the poster is asking. I wrote an
acts_as_graph as well, and it’s under http://gratr.rubyforge.org.

The difference here is that Tammersaleh’s fits 95% of most common usage
and looks like it does it cleanly and more “Railish”. The one I wrote
ties into advanced graph algorithms so crazy things like condensation
graphs and sub graphs determinations are possible. Also there is a rich
set of graph search algorithms in gratr.

Personally, after looking thorough tammersaleh’s code I’d use that if it
meets your needs. If you need some advanced graph manipulation, look at
gratr.