Alexander Suraphel
Alexander Suraphel

Reputation: 10603

Rails Ancestry: How do I get descendants that are at depth of n of a subtree?

I have a node which descendants I am interested in. But I am interested in descendants that are found at a specific depth. How do I do that?

Upvotes: 1

Views: 836

Answers (1)

Sagar535
Sagar535

Reputation: 36

https://github.com/stefankroes/ancestry#selecting-nodes-by-depth

Use the at_depth(n)

n being the depth of the nodes that you want to return

Note: the depth begins with value 0```

Upvotes: 2

Related Questions