def target_lft
scope_for_max_rgt = self.class.where(:root_id => root_id).where(:parent_id => parent_id)
if id
- #scope_for_max_rgt = scope_for_max_rgt.where("id < ?", id)
+ scope_for_max_rgt = scope_for_max_rgt.where("id < ?", id)
end
max_rgt = scope_for_max_rgt.maximum(:rgt)
if max_rgt
parent1.reload
parent2.reload
assert_equal [parent1.id, lft, lft + 5], [parent1.root_id, parent1.lft, parent1.rgt]
- assert_equal [parent1.id, lft + 3, lft + 4], [parent2.root_id, parent2.lft, parent2.rgt]
- assert_equal [parent1.id, lft + 1, lft + 2], [child.root_id, child.lft, child.rgt]
+ assert_equal [parent1.id, lft + 1, lft + 2], [parent2.root_id, parent2.lft, parent2.rgt]
+ assert_equal [parent1.id, lft + 3, lft + 4], [child.root_id, child.lft, child.rgt]
end
def test_move_a_child_to_root