Eager loading with acts_as_tree


Sigh, I have a new problem every day.

Okay I have a model that acts_as_tree, so I am trying to eager load the
objects + all of their children, plus their children’s children, and so
on. However, :include => :children alone doesn’t do this, and so far
I’ve got something like:

:include => [{:children => [{:children => [:children, :upload]},
:upload]}, :upload, :tags])

Is that not absurd or what? It’s so far the only way I can avoid
queries during rendering. Unfortunately that assumes the depth of the
tree, when in actuality it can be far greater.

Should I limit the depth of the tree? This is for a discussion forum of
sorts. I don’t know if it’s typical to have potentially infinite tree
depth in threaded forums.

Should I even worry about pre-loading all data before rendering or just
go with the flow? I’d like to cut down on the number of queries if