Forum: Ruby on Rails BetterNestedSet and Rails Caching

Announcement (2017-05-07): is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see and for other Rails- und Ruby-related community platforms.
D4d1f5fab34a12b8d341063385d5b484?d=identicon&s=25 (Guest)
on 2008-10-08 10:34
(Received via mailing list)

we have a simple category structure which is using BetterNestedSet. We
also use the caching functionality of Rails 2.1. In the development

config.cache_classes = false
config.cache_store = :memory_store

this little action

def level_test
  cat = Rails.cache.fetch("category") do
  render :text => "#{cat.level}"

breaks when the cache is hit (the second call to the action) telling
me that the Category class does not implement the "level" method. This
problem can be fixed turning cache_classes to true.

Why is acts_as_nested_set not called initializing the Category class
at the second request?


This topic is locked and can not be replied to.