Skip to content

Commit

Permalink
Reference ancestor_hierarchies in depth instead of ancestors (#398)
Browse files Browse the repository at this point in the history
* Reference ancestor_hierarchies in depth instead of ancestors

* Update CHANGELOG.md
  • Loading branch information
weilandia authored Apr 11, 2023
1 parent 3da8346 commit 2b1f088
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
### 8.0.0

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

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

Expand Down
2 changes: 1 addition & 1 deletion lib/closure_tree/model.rb
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ def leaves
end

def depth
ancestors.size
ancestor_hierarchies.size
end

alias_method :level, :depth
Expand Down

0 comments on commit 2b1f088

Please sign in to comment.