Added self_and_children, all_children and self_and_all_children methods. #1

Closed
wants to merge 2 commits into
from

Projects

None yet

2 participants

@makaroni4

Implementation for methods that returns children, all children (including children of children) with root node itself.

@swanandp
Collaborator

Thanks for contributing, I like the API. Just have one query regarding all_children. The ordering of all children is a concern I think. If one is treating the tree like windows explorer does, then the current ordering makes sense. But IMO, we should have the options of specifying the order of traversal (depth-first, breadth-first etc) instead of just sticking to one default.

I haven't really thought about the API for that, but if you have something in mind, please let me know.

@makaroni4

I was thinking about it and understood that very soon we will write clone of ancestry which is obviously wrong. This means that methods deal with all_children should not be in acts_as_tree, we need to leave it simple. So I think that self_and_children is enough to satisfy any acts_as_tree user.

What do you think?

@swanandp
Collaborator

I agree with you, so I pulled the request, and just kept the self_and_children method.

@swanandp swanandp closed this Apr 2, 2012
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment