Support for one node having multiple parents
Closed this issue · 4 comments
Does this support one node having multiple parents?
No, and I added a FAQ entry because you aren't the first person to ask...
Methods like the #ancestry_path would get funky (you'd have to return an array of arrays) which would break backward compatability.
The underlying closure tree structure absolutely can handle multiple parents, though.
The work is going to be non-trivial. It's going to affect a good portion of the code, and require a totally new test suite. It would be interesting to see if users of the library would be willing to update their code to adopt the new API in order to support this feature.
Thanks for the response
Start of work to support multiple parents.
Cuisine specs passing. Started working through other failing tests.
Thought this might be useful for anybody else wanting parents, no time to finish functionality at the moment.
https://github.com/mrloop/closure_tree/tree/parents
I had a need for multiple parents too and ended up bypassing closure tree. Here's a gist of my solution for multiple parents.