Class loading in development mode best practice / recommendation

In my project, I have a user model. The user model can be assigned
chores. Chores have an associated class object (that go by the name
'Service'). In the admin interface for users, the administrator can
assign these Chores to a user, and when they do this, they select the
Service for the Chore from a dropdown. My problem is getting the
service list.

All service classes inherit from Services::Base (MyService <
Services::Base) I want to provide the list of available services in
that dropdown, but when in development mode, the classes are unloaded
and reloaded with each request. Thus, using
Object.subclasses_of( Services::Base ) will not reliably get me a list
of available services, as the classes have probably been unloaded by
the time the code is reached.

Alternatively, I wanted to register available services via an
initializer, like: add_service MyService, but this depends on storing
values in a class, which also fails, for the same reason, as far as I
can tell (because the classes are being unloaded after each request).

Note, both of these methods work fine in test and production mode.

If there is any other information I can provide, please let me know.
Thanks all for the help.

I usually stick a bunch of require_dependency calls at the bottom of
the file containing the base class that loads the various subclasses

Fred

Thanks for the suggestion, Fred. That makes sense, and I would solve
the problem in this case.

Long term, I'm thinking of moving the framework out of the project and
into a gem. At that point, of course, it would be unrealistic to
include the require_dependency lines. Is there some other place you
can think of that I might put the code so that it's called with each
request, but not a part of the gem itself?

Thanks,
Joe

Thanks for the suggestion, Fred. That makes sense, and I would solve
the problem in this case.

Long term, I'm thinking of moving the framework out of the project and
into a gem. At that point, of course, it would be unrealistic to
include the require_dependency lines. Is there some other place you
can think of that I might put the code so that it's called with each
request, but not a part of the gem itself?

If you set config.to_prepare to a block then it's called before each
request (in development mode). Also code from gems isn't reloaded
between requests

Fred