This project is archived and is in readonly mode.

Changeset [9cfeefb637b603ce41d3019c8baa95ea984620d7] by wycats

May 15th, 2010 @ 02:09 PM

Reorganized initializers a bit to enable better hooks for common cases without the need for Railtie. Specifically, the following hooks were added:

  • before_configuration: this hook is run immediately after the Application class comes into existence, but before the user has added any configuration. This is the appropriate place to set configuration for your plugin
  • before_initialize: This is run after all of the user's configuration has completed, but before any initializers have begun (in other words, it runs right after config/environments/{development,production,test}.rb)
  • after_initialize: This is run after all of the initializers have run. It is an appropriate place for forking in a preforking setup

Each of these hooks may be used via ActiveSupport.on_load(name) { }. In all these cases, the context inside the block will be the Application object. This means that for simple cases, you can use these hooks without needing to create a Railtie.
http://github.com/rails/rails/commit/9cfeefb637b603ce41d3019c8baa95...

Committed by wycats

  • A activesupport/test/lazy_load_hooks_test.rb
  • M activerecord/lib/active_record/railtie.rb
  • M activesupport/lib/active_support/lazy_load_hooks.rb
  • M railties/guides/source/initialization.textile
  • M railties/lib/rails/application.rb
  • M railties/lib/rails/application/bootstrap.rb
  • M railties/lib/rails/application/configuration.rb
  • M railties/lib/rails/application/finisher.rb
  • M railties/lib/rails/engine.rb
  • M railties/lib/rails/railtie/configuration.rb
  • M railties/test/application/initializers/initializers_test.rb

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile »

<h2 style="font-size: 14px">Tickets have moved to Github</h2>

The new ticket tracker is available at <a href="https://github.com/rails/rails/issues">https://github.com/rails/rails/issues</a>