<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
  <meta content="text/html;charset=ISO-8859-1" http-equiv="Content-Type">
  <title></title>
</head>
<body bgcolor="#ffffff" text="#000000">
&nbsp;&nbsp;&nbsp; I think it would be best if you could post your SQL that is messed
up as well as the code you are using to save your nodes.&nbsp; Unfortunately
we can't tell you what is wrong until we actually see the logic behind
what you are doing.<br>
<br>
--<br>
Jeremy Nicoll<br>
<br>
Matt Rogish wrote:
<blockquote
 cite="mid:ab45a6ff0708141041x4d0b7a17n4cd96f4af3c7511f@mail.gmail.com"
 type="cite">How can I repair my tree?<br>
  <br>
I have a message board system in which the messages are grouped by
"message_board_id", 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'm not sure if I'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's guess is that the "root" condition is
wrong, since it'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'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 moz-do-not-send="true"
 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'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>
  <pre wrap="">
<hr size="4" width="90%">
_______________________________________________
Betternestedset-talk mailing list
<a class="moz-txt-link-abbreviated" href="mailto:Betternestedset-talk@rubyforge.org">Betternestedset-talk@rubyforge.org</a>
<a class="moz-txt-link-freetext" href="http://rubyforge.org/mailman/listinfo/betternestedset-talk">http://rubyforge.org/mailman/listinfo/betternestedset-talk</a>
  </pre>
</blockquote>
</body>
</html>