GitHub User: jackpipe
A couple of things I found:
The recursive function given in the cast does not correctly handle the situation where you have siblings in the subtree. In this case it incorrectly emits empty <div> sections.
You must add attr_accessible :parent_id or some other accommodation so that adding new sub-messages does not produce a mass-assignment exception.