What's the right way to factor this?

Ok, so I’ve been going around in circles with something. I have a
fairly complex view-related thing that started out as a bunch of
helpers.

I decided I wanted to make a class out of the thing and make it
re-usable so I can use it all over this rather large app. In order to
make it re-usable, it needs to have some configuration applied to it for
use in different parts of the app. That means it needs to save some
configuration data; so there is instance data, so in order to use it
through out the life of a particular ajax view, I need to be able to
save it in the session.

Sooooooo, when I go to try and save this thing in the session, the
session needs for me to “require” it so the serialization will work. It
isn’t a model, so I can’t just save an id and re-find it in each action,
the way you would with a model. I can’t make it an active record model,
because models don’t have access to all the helpers that views and
helpers have access to. I can’t “require” it because require works on a
file, not just a class within a helper file.

You see where I’m going here? I seem to have painted myself into a
corner with this thing and I don’t know how to get all of the aspects of
Rails to come together and let me do what I want to do here.

Basically, I need a class that is in a helper file or in some other way
has access to all the view-related rails helper stuff (like the ‘h()’
function and link_to_remote et. al.). I need to be able to save
instances of this thing in the session also, which seems to make it
necessary for it to be in its own file so I can “require” it from the
Controller file…

Any suggestions?

thanks,
jp