On Mon, Sep 8, 2008 at 1:32 AM, Michael Allman <[EMAIL PROTECTED]> wrote:
> I noticed Rails reloads my classes on every request. My database
> can't handle that. My database depends on classes maintaining their
> identity. That is, given a class "Person", Person.object_id must not
> vary across requests. Is there a way to turn off this "reload per
> request" behavior? And why does it do this in the first place? Seems
> rather strange.
This is done to be able to refresh changes automatically while you are
developing, since normally that's more handy than restarting the
server by hand to load changes. You can turn it off setting
config.cache_classes = true
in config/environments/development.rb.
Take into account that if you restart the application object IDs for
the same classes are not guaranteed to be the same (in general they
won't be).
Also take into account that in the typical multi-process setup there
are as many interpreters running as processes, and thus those handlers
are going to run those many times.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby
on Rails: Talk" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---