Rails Ancestry:我如何得到子树深度为n的后代?

时间:2017-03-15 08:00:57

标签: ruby-on-rails activerecord ancestry

我有一个节点,我感兴趣的后代。但我感兴趣的是在特定深度找到的后代。我怎么做?

1 个答案:

答案 0 :(得分:0)

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```