views:

63

answers:

0

I am using Memcached as an Object Store with my Rails application where I store search results which are User objects in memcached

Now when I fetch the data out I get the Memcached Undefined Class/Module Error. I found a solution for this problem in this blog

http://www.philsergi.com/2007/06/rails-memcached-undefinded-classmodule.html

 before_filter :preload_models
  def preload_models
    Model1
    Model2
  end

which recommends pre-loading the models before hand. I would like to know if there is a more elegant solution to this problem and are there any drawbacks in using the preloading technique.

Thanks in advance