After going through this today, I managed to come up with a more subtle solution that should work for all classes.
Rails.cache.instance_eval do def fetch(key, options = {}, rescue_and_require=true) super(key, options) rescue ArgumentError => ex if rescue_and_require && /^undefined class\/module (.+?)$/ =~ ex.message self.class.const_missing($1) fetch(key, options, false) else raise ex end end end
I donโt know why [MemCacheStore] doesnโt have the [MemCacheStore.const_missing] method, and everything calls the Rails-y call in normal mode. But that should imitate that!
Greetings
Chris
Chris lowder
source share