Skip to content

Commit 2b1f088

Browse files
authoredApr 11, 2023
Reference ancestor_hierarchies in depth instead of ancestors (#398)
* Reference ancestor_hierarchies in depth instead of ancestors * Update CHANGELOG.md
1 parent 3da8346 commit 2b1f088

File tree

2 files changed

+2
-1
lines changed

2 files changed

+2
-1
lines changed
 

‎CHANGELOG.md

+1
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
### 8.0.0
44

55
- Drop support to EOL ruby and rails
6+
- Reference ancestor_hierarchies in depth instead of ancestors to avoid n+1
67

78
## [7.4.0](https://github.com/ClosureTree/closure_tree/tree/7.4.0)
89

‎lib/closure_tree/model.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ def leaves
7777
end
7878

7979
def depth
80-
ancestors.size
80+
ancestor_hierarchies.size
8181
end
8282

8383
alias_method :level, :depth

0 commit comments

Comments
 (0)
Please sign in to comment.