0
Я использую gem ancestry
в приложении Rails3.Rails Ancestry gem rebuild cache
Я пытаюсь изменить существующую модель с именами сайтов, чтобы использовать глубину кеша.
В документации сказано, это:
:cache_depth Cache the depth of each node in the 'ancestry_depth' column (default: false)
If you turn depth_caching on for an existing model:
- Migrate: add_column [table], :ancestry_depth, :integer, :default => 0
- Build cache: TreeNode.rebuild_depth_cache!
Я добавил миграции.
Но я не понимаю, как выполнить - Build cache: TreeNode.rebuild_depth_cache!
Где я могу это сделать?
Благодарим за помощь!
Использование консоли Rails. 'S = Site.new' дает мне' 2.0.0p353: 001> s = Site.new => # <Идентификатор сайта: nil, name: nil, description: nil, type_id: nil, tenant_id: nil, created_at: nil, updated_at: nil, address1: nil, address2: nil, city: nil, state: nil, zipcode: nil, ancestry: nil, position: nil, ancestry_depth: 0> ' – Reddirt
' s.rebuild_depth_cache! 'дает мне' NoMethodError : undefined method 'rebuild_depth_cache! ' для # <Сайт: 0x007fa000800618> ' – Reddirt
Это сработало -' Site.rebuild_depth_cache! ' – Reddirt