How can I repair my tree?<br><br>I have a message board system in which the messages are grouped by &quot;message_board_id&quot;, thus my model is:<br>acts_as_nested_set :scope =&gt; :message_board_id <br><br>Somehow the tree is messed up, inasmuch as some roots (parent_id == null) are being set to the children of some other message, so I cannot successfully repair it. I&#39;m not sure if I&#39;m performing incorrect operations or what, but somehow I need to repair my tree where message_board_id = 34 (or whatever it is).
<br><br>It seems as if renumber_full_tree tries to find the virtual root for a given node, but since the root itself is a CHILD of another node, the whole thing fails. My layman&#39;s guess is that the &quot;root&quot; condition is wrong, since it&#39;s doing WHERE parent_id IS NULL ... AND lft BETWEEN .. AND ..
<br><br>Well, if the root is incorrectly between something, then the lft would fail, no? Maybe I&#39;m misreading that. Help!!<br><br>Thanks,<br><br>--<br>Matt<br><br><div><span class="gmail_quote">On 8/14/07, <b class="gmail_sendername">
Matt Rogish</b> &lt;<a href="mailto:rogishmn@muohio.edu">rogishmn@muohio.edu</a>&gt; wrote:</span><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
Under heavy load we are getting significantly screwed up data. I have to run renumber_full_tree in script/console production order to repair the thing.<br><br>Obviously this is a bad thing, but I don&#39;t even know where to start to fix it. Any ideas?
<br><br>Thanks,<br><br>--<br><span class="sg">Matt<br>
</span></blockquote></div><br>