stefankroes / ancestry

Organise ActiveRecord model into a tree structure
MIT License
3.71k stars 458 forks source link

add support for virtual parent_id and root_id #679

Open kbrock opened 5 months ago

kbrock commented 5 months ago

As seen in #662, add support for the database to define a parent_id and root_id virtual column.

This makes the sql much easier to generate.

In order to get a pure rails belongs_to :parent, :class => self.class.name (children, ...) working, would still need to find a good way to pass the path and not the parent_id value.