If I save some object in session and then restart the server, I get
the following error unless I restart my web browser (or delete
Session contains objects whose class definition isn’t available.
Remember to require the classes for all objects kept in the session.
(Original exception: uninitialized constant TZInfo [NameError])
I know what the problem is. Rails hasn’t loaded “TZInfo::Timezone”
class definition yet so it doesn’t know how to handle
“TZInfo::Timezone” object stored in the session. If an ActiveRecord
model is saved in the session, using “model” method in
“ApplicationController” with the symbol for the model name does the
trick of loading the class definition before the session data is
accessed. But what about non-ActiveRecord objects? How do I force
loading the class definition?
Also, I read somewhere that we don’t need to use “model” method any
more for loading ActiveRecord models. Can anyone confirm this?
I will appreciate any comments, thanks!
PS: I have already looked at the rails wiki pages. The solution to
this particular problem isn’t covered there.