views:

53

answers:

1

environment.rb starts with this:

RAILS_GEM_VERSION = '2.3.2' unless defined? RAILS_GEM_VERSION
require File.join(File.dirname(__FILE__), 'boot')
Rails::Initializer.run do |config|

Does this mean environment.rb starts first and calls boot.rb?

+1  A: 

The environment.rb is the main Rails environment file. It requires the boot.rb file but the boot.rb is run before Rails::Initializer.run. In fact, the last line of boot.rb contains the following statement

# All that for this:
Rails.boot!

Please note that while the environment.rb file belongs to your Rails app, the boot.rb file is automatically updated each time you run the rake task

rake update:rails

You should never modify that file.

To better understand how Rails initialization works, Sven wrote a really helpful article called The Rails startup process from a paragliders perspective.

Simone Carletti