Rails Development Environment and Reloading Models


By default, rails reloads all your models, while in development mode, with each new request. Is there anyway to specify that a given model, or models, should not be reloaded? This is specific to rails 1.2.3


As far as I know there is only a way to disable reloading in general.
Why would you need it to be selective? Are you patching the class in
a way that is being undone? I am patching several classes and this
has not appeared to be an issue to date. The only issue has been when
I modify the patches themselves and I need to restart the server to
get environment.rb to be processed again (where some of my patches are


Thanks for responding Michael (^_^)

The reason I need specific classes to be reloaded has to do with a plugin I’m working on. The plugin defines classes on the fly based on info from a few db tables–I know this is probably not the best of solutions… Anyway, I’m running into problems when rails reloads these particular models. Everything works find in production mode, but in dev mode I keep getting const_missing errors as rails can’t find the definitions for my “dynamic” classes after a reload.

I did find a work around however. If you stick stuff in the lib directory of your app, then it gets loaded only once, regardless of the environment.