ltree_hierarchy icon indicating copy to clipboard operation
ltree_hierarchy copied to clipboard

Doesn't support arbitrary fragments

Open andrewhamon opened this issue 9 years ago • 1 comments

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.

andrewhamon avatar Jul 19 '15 07:07 andrewhamon

I'm hoping #21 will resolve this issue.

alibby avatar Jun 16 '17 14:06 alibby