Hi Krishna,<br><br>I have no move code (moving is not allowed! :D), my delete code is fairly straightforward:<br> def destroy<br> m = Message.find(params[:id])<br><br> #security check to make sure they can delete snipped
<br> <br>
m.destroy<br> redirect_back_or_default :controller => :message_boards, :action => :show, :id => @current_message_board<br> end<br><br>All tables are innodb_tables:<br>SHOW CREATE TABLE messages;<br>CREATE TABLE `messages` (
<br>...<br>) ENGINE=InnoDB <span id="e_11465b10e45a442f_1"><br><br>--<br>Matt<br></span><br><div><span class="gmail_quote">On 8/14/07, <b class="gmail_sendername">Krishna Dole</b> <<a href="mailto:dontfall@gmail.com">
dontfall@gmail.com</a>> wrote:</span><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">Hi Matt,<br><br>Is this the only code you have that alters the tree? Any delete/move
<br>code? Also, are you using a transactional storage engine? (basically<br>anything other than MyISAM, I think).<br><br>I presume the message_board_id is being set from params[:message].<br><br>Krishna<br><br>On 8/14/07, Matt Rogish <
<a href="mailto:rogishmn@muohio.edu">rogishmn@muohio.edu</a>> wrote:<br>> I'm not writing any SQL, I'm using built-in better-nested-set functions.<br>><br>> Here's my save:<br>> def create<br>
> @message = Message.new(params[:message])<br>><br>> if @message.save<br>> flash[:notice] = 'Message was successfully created.'<br>><br>> if params[:message][:parent_id]<br>> @
message.move_to_child_of( Message.find params[:message][:parent_id]<br>> )<br>> @message.save<br>> end<br>> end<br>> end<br>><br>> --<br>> Matt<br>><br>><br>><br>> On 8/14/07, Jeremy Nicoll <
<a href="mailto:jnicoll@goldnoteexpress.com">jnicoll@goldnoteexpress.com</a> > wrote:<br>> ><br>> > I think it would be best if you could post your SQL that is messed up<br>> as well as the code you are using to save your nodes. Unfortunately we
<br>> can't tell you what is wrong until we actually see the logic behind what you<br>> are doing.<br>> ><br>> > --<br>> > Jeremy Nicoll<br>> ><br>> > Matt Rogish wrote:<br>> >
<br>> > How can I repair my tree?<br>> ><br>> > I have a message board system in which the messages are grouped by<br>> "message_board_id", thus my model is:<br>> > acts_as_nested_set :scope => :message_board_id
<br>> ><br>> > Somehow the tree is messed up, inasmuch as some roots (parent_id == null)<br>> are being set to the children of some other message, so I cannot<br>> successfully repair it. I'm not sure if I'm performing incorrect operations
<br>> or what, but somehow I need to repair my tree where message_board_id = 34<br>> (or whatever it is).<br>> ><br>> > It seems as if renumber_full_tree tries to find the virtual root for a<br>> given node, but since the root itself is a CHILD of another node, the whole
<br>> thing fails. My layman's guess is that the "root" condition is wrong, since<br>> 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
<br>> fail, no? Maybe I'm misreading that. Help!!<br>> ><br>> > Thanks,<br>> ><br>> > --<br>> > Matt<br>> ><br>> ><br>> > On 8/14/07, Matt Rogish <<a href="mailto:rogishmn@muohio.edu">
rogishmn@muohio.edu</a>> wrote:<br>> > > Under heavy load we are getting significantly screwed up data. I have to<br>> run renumber_full_tree in script/console production order to repair the<br>> thing.<br>
> > ><br>> > > Obviously this is a bad thing, but I don't even know where to start to<br>> fix it. Any ideas?<br>> > ><br>> > > Thanks,<br>> > ><br>> > > --<br>
> > > Matt<br>> > ><br>> ><br>> > ________________________________<br>><br>> > _______________________________________________<br>> > Betternestedset-talk mailing list<br>> >
<a href="mailto:Betternestedset-talk@rubyforge.org">Betternestedset-talk@rubyforge.org</a><br>> ><br>> ><br>> ><br>> <a href="http://rubyforge.org/mailman/listinfo/betternestedset-talk">http://rubyforge.org/mailman/listinfo/betternestedset-talk
</a><br>> ><br>> ><br>> > _______________________________________________<br>> > Betternestedset-talk mailing list<br>> > <a href="mailto:Betternestedset-talk@rubyforge.org">Betternestedset-talk@rubyforge.org
</a><br>> ><br>> <a href="http://rubyforge.org/mailman/listinfo/betternestedset-talk">http://rubyforge.org/mailman/listinfo/betternestedset-talk</a><br>> ><br>> ><br>><br>><br>> _______________________________________________
<br>> Betternestedset-talk mailing list<br>> <a href="mailto:Betternestedset-talk@rubyforge.org">Betternestedset-talk@rubyforge.org</a><br>> <a href="http://rubyforge.org/mailman/listinfo/betternestedset-talk">http://rubyforge.org/mailman/listinfo/betternestedset-talk
</a><br>><br>><br>_______________________________________________<br>Betternestedset-talk mailing list<br><a href="mailto:Betternestedset-talk@rubyforge.org">Betternestedset-talk@rubyforge.org</a><br><a href="http://rubyforge.org/mailman/listinfo/betternestedset-talk">
http://rubyforge.org/mailman/listinfo/betternestedset-talk</a><br></blockquote></div><br>