Rails Ancestry Named scope 'to_depth' is only available when depth caching is enabled

Hi Everyone,

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

Postingan populer dari blog ini

EPrT English Proficiency Test Soal - soal

cara memunculkan dan menyembunyikan icon date, time, clock, volume, network, power battery, action center pada taskbar pada Windows 7

Cara Mengurus Perpanjang SIM dan Rincian Biaya di Lumajang.