closure_tree
closure_tree copied to clipboard
Initial counter_cache implementation
This implements a counter_cache option, which is passed to the parent relationship. This allows closure tree structures to use tag.tags_count rather than tag.children.count. This is much faster for large data sets, where counts are prohibitively slow.
TODO
- [ ] Sufficient performance
- [ ] Sufficient tests
- [ ] Write documentation for the feature
I would love the maintainers comments on the three TODO items above, to make sure that this PR doesn't break anything, and brings good enough performance and documentation.
Thanks, Emil
This sort of picks up where https://github.com/ClosureTree/closure_tree/pull/109 left off. But it's re-implemented from scratch.