Rails Ancestry Named scope 'to_depth' is only available when depth caching is enabled
I will share to you about my experience when had error "Named scope 'to_depth' is only available when depth caching is enabled". Please try below:
1. Add new migration
- Migrate: add_column [tables], :ancestry_depth, :integer, :default => 0
- Build cache: TreeNode.rebuild_depth_cache!
2. Go to model
- has_ancestry cache_depth: true
I hope this article can help you. :)
Komentar
Posting Komentar
terimakasih komentarnya