Is Rails missing a rail-road tie?

...or just as likely, I just don't get it yet.

I'm loving Rails so far, but I just ran into a situation that I haven't found a clean solution for. My first question about this went unanswered so I'll try to simplify it.

Where can I put some code that has all of these attributes: -- it is a class with some instance variables -- it is view-related code and needs to access all of the Action-Pack stuff like "h()" and form tags etc. -- it is not and should not be an active-record model -- it needs to live through multiple http round trips and ajax cycles, therefore I need to be able to save an instance of the object in the session. -- it will be used by multiple views and controllers throughout a fairly large app

It is basically a more complex version of the things you would usually find in the application helper file. If I just put the class in there, all is well except that I don't know how to give it the necessary magic that lets an instance of an object be saved in the session.

That is really the key part. How can I make a class that is defined in a helper file known to the stuff that serializes an object for the session hash? I think it involves having a ".to_xml" method for the object, but I think there is some more to it.

My initial reaction is what are you storing in a session that needs access to view-related methods? That doesn't seem to follow MVC as I understand it...

If you can split the view-related aspects out of it then you could simply put a normal ruby class into RAILS_ROOT/lib or RAILS_ROOT/models and go on your merry way...

What are you trying to do specifically?