I thought it would be nice if my login code handled session and cookie management in a Session class, rather than explicitly in the controller. So I made the session class attach itself to the current session: module Hark class Session def self.get(session, cookiejar) session[:hark_session] ||= self.new(cookiejar) end def initialize(cookiejar) @cookiejar = cookiejar end end end Then I call it from my login action: class HarkController < ApplicationController def login if request.post? hs = Hark::Session.get(session, cookies) ... end This works beautifully in unit tests, but when I try to run it in webrick, I get an error when it tries to serialize the session; apparently, the CookieJar contains an anonymous class. Is there some way I can allow my session class to get/set cookies without passing it the CookieJar each time? On the face of it, I''d need to store a "pointer" to the CookieJar#[] and CookieJar#[]= functions, without storing the cookiejar itself. But that''s not very Rubyish. Ideas? Jay Levitt --~--~---------~--~----~------------~-------~--~----~ 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 rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk -~----------~----~----~----~------~----~------~--~---