I want to be able to set class attributes (in particular,
ActiveResource::Base user, password, site, etc.) and for them to be
isolated to a given request, both in terms of thread safety, and so
that for the next request they are reset to defaults. For instance, if
I set user and password, I want to make sure the user and password set
for one user do not accidentally get used for a different user on a
subsequent request. I could do this with a before_filter, but that
seems like the wrong place to manage a model class' instance
I'm not sure if the threading issue is really a problem, because I
understand most rails servers are single threaded, but would it be a
good idea to use Thread.current in class_attribute to provide thread
Secondly, what do you think of providing a way of resetting the value
of class attributes between requests?
class_attribute :x, :default => 'x will have this value at the
beginning of every request'
# this gets run at the beginning of every request
self.x = 'Initial value'
ActiveResource::Base.user doesn't actually seem to be using
class_attribute right now, but I assume it could be updated to do so.
Please correct me if I have misunderstood the issues.