root_id The root_id provides the scope for a nested_set tree. The implicit constraint of the Issue implementation is that there is but one tree per scope. Or in other words, the root_id is part of the nested_set attributes for an issue. This is not the case for Project, which is also using nested_set but does not set a scope. Project's are ordered that way. The root_id should always point to the root of an issue tree. awesome_nested_set only looks for nodes without a parent in the provided scope to determine root nodes. For example, if the root_id of an issue should point to the node itself, this issue is considered to be a root node. This is regardless of the value of the parent_id. For such a node, nested_set methods will provide wrong issues when queried for root, ancestors and similar methods. Fixing a missconfigured root_id attribute is achived by traversing up the parent chain (parent_id) till an issue without a parent is found. The parent_id attribute is considered to be correct. The root_id is not really necessary for awesome_nested_set to work. But employing the field should be beneficial performancewise. Updating an issue tree requires less nodes' left/right attribute to be altered when the forrest is scoped.pull/5/head
parent
47a89b8bfa
commit
3adca91704
Loading…
Reference in new issue