Collecting Recursively
by Sean Cribbs
Yesterday I was working with an acts_as_tree
model and
wanted to get all children of the current model as an array. Since
there's no descendants
method, this is what I came up
with.
Then when I want the model and all its children I do:
May not be useful to everyone, but I found it to be a fun exercise.