ltree_hierarchy
ltree_hierarchy copied to clipboard
Doesn't support arbitrary fragments
Suppose I have a table nodes with attributes id, parent_id, and name.
It would but much more convenient for the paths to use names instead of ids, at least for my purposes.
Changing the fragment setting breaks most the libraries functionality, mostly due to assumptions on the relationship between fragment and parent_fragment
for example:
def children
ltree_scope.where(ltree_parent_fragment_column => ltree_fragment)
end
always returns nothing if the fragment setting is changed to name, since we would essentially be querying Node.where(id: "some_string") (and the final query would end up looking like WHERE id = 0 since "some_string".to_i will return 0)
I realize that supporting this would probably require a lot of changes, but I figured it would be worth getting people's thoughts on.
I'm hoping #21 will resolve this issue.