The subtree.arrange scope does not work if you have a default scope on your model, you also cannot use the inline unscoped method to undo the default scope, as this also undoes the 'subtree' scope. You have to use
ruby
Model.unscoped do@model.subtree.arrange
end
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.
A couple of things I found:
subtree.arrange
scope does not work if you have a default scope on your model, you also cannot use the inlineunscoped
method to undo the default scope, as this also undoes the 'subtree' scope. You have to useThe 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.