clyfe/acts_as_nested_interval

Does descendants only work for the root node?

caio-northfleet opened this issue · 3 comments

Hi,

I just started using the gem and playing with the Regions example. It seems only "Earth" has descendants. I would expect to get descendants for other nodes like "Oceania" but an empty list is returned.

Anscestors is work as expected.

Thanks,
Caio

Update:
As I started by following the Regions sample, I've created the "lft" and "rgt" columns. When "lft" is present, it is used, but its value on all entries is 0, so "descendants" don't work quite well. I guess I can just remove those two columns.

Another question:
"descendants" gets defined differently if connector is "MySql". I saw a reference for "mysql2" down the path. Wouldn't it be better to use the same "descendants" definition for both connector types?

Thanks again, and great work with this gem!!

Update 2:
Problem seems to be related to multiple root nodes. If I create a single dummy root node and add it as parent of my root nodes, everything works fine.

Use the scope_columns parameter to scope independent trees.