Forum: Ruby on Rails BetterNestedSet and Rails Caching

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

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

config.cache_classes = false
config.cache_store = :memory_store

this little action

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

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?

Thanx,

Tobi
This topic is locked and can not be replied to.