Skip to content

Commit

Permalink
preinitializer.rb is no longer needed, so remove it from the guide an…
Browse files Browse the repository at this point in the history
…d replace with better suggestion. [#4279 state:resolved]
  • Loading branch information
wycats committed Mar 29, 2010
1 parent 201e898 commit bd69589
Showing 1 changed file with 7 additions and 9 deletions.
16 changes: 7 additions & 9 deletions railties/guides/source/configuring.textile
Expand Up @@ -9,24 +9,24 @@ endprologue.


h3. Locations for Initialization Code h3. Locations for Initialization Code


Rails offers (at least) five good spots to place initialization code: Rails offers (at least) four good spots to place initialization code:


* Preinitializers * application.rb
* environment.rb
* Environment-specific Configuration Files * Environment-specific Configuration Files
* Initializers (load_application_initializers) * Initializers (load_application_initializers)
* After-Initializers * After-Initializers


h3. Using a Preinitializer h3. Running Code Before Rails


Rails allows you to use a preinitializer to run code before the framework itself is loaded. If you save code in +RAILS_ROOT/config/preinitializer.rb+, that code will be the first thing loaded, before any of the framework components (Active Record, Action Pack, and so on.) If you want to change the behavior of one of the classes that is used in the initialization process, you can do so in this file. To run some code before Rails itself is loaded, simply put it above the call to
+require 'rails/all'+ in your +application.rb+.


h3. Configuring Rails Components h3. Configuring Rails Components


In general, the work of configuring Rails means configuring the components of Rails, as well as configuring Rails itself. The +environment.rb+ and environment-specific configuration files (such as +config/environments/production.rb+) allow you to specify the various settings that you want to pass down to all of the components. For example, the default Rails 2.3 +environment.rb+ file includes one setting: In general, the work of configuring Rails means configuring the components of Rails, as well as configuring Rails itself. The +application.rb+ and environment-specific configuration files (such as +config/environments/production.rb+) allow you to specify the various settings that you want to pass down to all of the components. For example, the default Rails 2.3 +application.rb+ file includes one setting:

This comment has been minimized.

Copy link
@nertzy

nertzy Mar 29, 2010

Contributor

Rails 2.3 -> 3.0



<ruby> <ruby>
config.time_zone = 'UTC' config.filter_parameters << :password
</ruby> </ruby>


This is a setting for Rails itself. If you want to pass settings to individual Rails components, you can do so via the same +config+ object: This is a setting for Rails itself. If you want to pass settings to individual Rails components, you can do so via the same +config+ object:
Expand All @@ -53,8 +53,6 @@ h4. Rails General Configuration


* +config.eager_load_paths+ accepts an array of paths from which Rails will eager load on boot if cache classes is enabled. All elements of this array must also be in +load_paths+. * +config.eager_load_paths+ accepts an array of paths from which Rails will eager load on boot if cache classes is enabled. All elements of this array must also be in +load_paths+.


* +config.frameworks+ accepts an array of rails framework components that should be loaded. (Defaults to +:active_record+, +:action_controller+, +:action_view+, +:action_mailer+, and +:active_resource+).

* +config.load_once_paths+ accepts an array of paths from which Rails will automatically load from only once. All elements of this array must also be in +load_paths+. * +config.load_once_paths+ accepts an array of paths from which Rails will automatically load from only once. All elements of this array must also be in +load_paths+.


* +config.load_paths+ accepts an array of additional paths to prepend to the load path. By default, all app, lib, vendor and mock paths are included in this list. * +config.load_paths+ accepts an array of additional paths to prepend to the load path. By default, all app, lib, vendor and mock paths are included in this list.
Expand Down

0 comments on commit bd69589

Please sign in to comment.