Ticket #38 (new enhancement)

Opened 1 year ago

Last modified 1 year ago

Provide a way to recompute the lft and rgt fields on the whole tree

Reported by: rails Assigned to: jcm
Priority: major Milestone:
Component: plugin Version:
Keywords: Cc:

Description

Hi,

Due to some problem with caching a parent row and reusing it when building a tree, I've corrupted the lft and rgt fields, that is to say their state doesn't match the hierarchy defined by the parent_id foreign key references.

What would be great is a class method that would rebuild the whole table, just trusting the parent_id references. Obviously, this would loose any ordering of the nodes, but at least it would restore the table in a usable state.

Thanks for this great plugin !

Change History

10/22/07 14:20:28 changed by rails

As a workaround, I look for faulty rows (the ones that don't verify row.lft>row.parent.lft && row.rgt<row.parent.rgt) and re-apply row.move_to_child_of row.parent. This seems to correct the problem.