This repository is private.
All pages are served over SSL and all pushing and pulling is done over SSH.
No one may fork, clone, or view it unless they are added as a member.
Every repository with this icon (
) is private.
Every repository with this icon (
This repository is public.
Anyone may fork, clone, or view it.
Every repository with this icon (
) is public.
Every repository with this icon (
Loading…
Labels












Take a look at my fork: http://github.com/retoo/awesome_nested_set/tree/master
I've done something similar:
In this case I wanted the corresponding level of each subelement, but the same system could be used to 'walk' through the tree knowning the current path or recursivly iterate through it. etc.
Sounds reasonable. Want to work up a patch with tests?
I've written some tests for each_with_level and pushed them to my repo. FYI, I've rebased my first commit to your current master.
Two things I'm still a bit unsure about.
a) as it is now, as a class method of the model? b) as a instance method? root.each_with_level (which would internally fetch self_and_descendants) c) somewhere in the array returned by the different fetcher methods? d) the data should be 'embeded' while fetching from the database? So it would be available all the time?
a) the array containing all nodes to be processed? b) the root node?
I plan to add other helpers (like the each_with_path) when I get to it. Perhaps some further tests with sub-trees wouldn't hurt.