On 1/4/07, Lee <lee_longmore-/E1597aS9LT10XsdtD+oqA@public.gmane.org>
wrote:>
> I understand that all application classe files are reloaded before
> processing each HTTP request when in development mode (by default,
> using Ruby "load"). I assume therefore that the corresponding
class
> objects (controller, model) are also created at the same time, along
> with dynamically created methods such as those required for
> associations such as has_many. Correct so far?
That''s correct. When Rails initializes, it loads only the framework
and plugins. After that, controllers/models/etc are loaded as they''re
used in your app.
> What happens to these class objects and other objects created during
> request processing - i.e. controller and model objects such as created
> by c=Customer.new - at the completion of request processing lifecycle
> (post-render)? Do they get swept up by garbage collection? Is the
> behaviour the same in production mode? Does anything persist between
> requests, apart from session (and flash) objects?
Const.remove is called on them I believe. See more in the
Dependencies module in ActiveSupport:
http://dev.rubyonrails.org/browser/trunk/activesupport/lib/active_support/dependencies.rb
This doesn''t happen in production mode to keep it as fast as possible.
You won''t have classes being reloaded, running all the
metaprogramming magic (such as the various AR associations), or models
retrieving the table structure from the DB.
--
Rick Olson
http://weblog.techno-weenie.net
http://mephistoblog.com
--~--~---------~--~----~------------~-------~--~----~
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
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---