Forum: Ruby on Rails Rails Development Environment and Reloading Models

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
Steven H. (Guest)
on 2007-06-14 22:02
(Received via mailing list)
Hi,

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


Thanks,
Steven
MichaelLatta (Guest)
on 2007-06-14 22:13
(Received via mailing list)
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
loaded).

Michael
Steven H. (Guest)
on 2007-06-14 23:02
(Received via mailing list)
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.

Regards,
Steven
This topic is locked and can not be replied to.