Hi Fabien, The new sibling reordering methods look good to me. I see your aliased method names for acts_as_list now-- for some reason I missed those. That looks great. As for whether we just use only the acts_as_list method names, I don''t have a strong opinion either way. I''m fine with retaining the #swap method. I recently refactored move_to, so I think I could combine them. If you need #swap now go ahead and include it, otherwise I will work on combining it with move_to over the next few weeks. Cheers, Krishna On 1/10/07, Atelier Fabien - Fabien Franzen <info at atelierfabien.be> wrote:> Krishna, > > I''ve changed the sibling methods now.: > > # Moves a node one up amongst its siblings. Does nothing if it''s already > # the first sibling. > def move_lower > next_sib = next_sibling > move_to_right_of(next_sib) if next_sib > end > > # Moves a node one down amongst its siblings. Does nothing if it''s > already > # the last sibling. > def move_higher > prev_sib = previous_sibling > move_to_left_of(prev_sib) if prev_sib > end > > # Moves a node one to be the first amongst its siblings. Does nothing > if it''s already > # the first sibling. > def move_to_top > first_sib = first_sibling > move_to_left_of(first_sib) if first_sib && self != first_sib > end > > # Moves a node one to be the last amongst its siblings. Does nothing > if it''s already > # the last sibling. > def move_to_bottom > last_sib = last_sibling > move_to_right_of(last_sib) if last_sib && self != last_sib > end > > These provide the results you''d expect; my first attempt did indeed > cause undesirable movement. > > I''m still a bit stuck with #swap though. It seems like a good method > for distant nodes, but I agree that #move_to should be able to handle > this. Maybe by delegation of #swap to #move_to(target, :swap) ? To be > honest, the #swap method is a snippet of code I gathered some time > ago, not sure where I got it from. I guess someone with in-depth > knowledge of the #move_to internals should be able to incorporate > a :swap option easily. Then, it would probably even work at different > levels, whilst the current version is restricted to the same level > (siblings). That would be awesome. > > - Fabien > >