Hi Colin and thanks for the suggestion. But the problem is more intricate than this, I am afraid. The reason I want to keep the object is that it connects via sockets to a pool of servers (at least 4 of them). When the object is marshaled, either for storage in the session or in the db these connections are lost. Maybe there is another solution but as I understand it the only way to keep these connections is to keep the object itself, not a serialized copy.
Extremely grateful for any further input. Regards Erik On 27 mar, 17:52, Colin Law <[email protected]> wrote: > On 27 March 2010 15:44, Erik Lindblad <[email protected]> wrote: > > > Is there a way to create an object that is a singleton (one instance > > per user session) and is kept as long as the user session exists? The > > object handles a connection to a remote server that is very heavy to > > establish so I would like to reuse the same object in following > > requests. > > You have answered your own question, put it in the session. If it is > a large object then put it in the db and reference it from the > session. > > Colin -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

