From: Rob Lally Date: 2005-03-27T02:31:09+09:00 Subject: Re: Model object in session problems Thanks - that solves the problem. I don't understand why it is necessary though. I assumed that the application had already required the User class and the user file since this is reading in something it just created and wrote out. What am I missing? R. Moses Hohman wrote: > If you "require 'user'" in your application.rb (so that it will be > required in every controller), the problem should go away. The problem > is, as I understand it, that the homepage controller does not > automatically know to require 'user'. > > On Mar 26, 2005, at 10:52 AM, Rob Lally wrote: > >> Sorry - just realised I sent this to the ruby list rather than the >> rails list. >> >> R. >> >> Rob Lally wrote: >> >>> Hi, >>> I'm having a problem storing an AR model object in a session. >>> Actually the problem doesn't seem to be related to storing it in a >>> session. The problem occurs when the session is deserialised on the >>> next request. >>> When the user logs in I pop a User object (an AR model) into the >>> session and redirect to the homepage. Then I see the following error >>> >> where the class definition wasn't available. Remember to require >>> classes for all objects kept in the session. The session has been >>> deleted. (Original exception: undefined class/module User >>> [ArgumentError])> >>> Can anyone shed any light on my problem? >>> Thanks, >>> R.