This is the config method in Rails::Application in the railties column in lib/rails/application.rb that returns the instance of Application::Configuration defined in lib/rails/application/configuration.rb .
The configure method is introduced in Railtie from the autoload ed Configurable module, lib/rails/railtie/configurable and is defined as
def configure(&block) class_eval(&block) end
which explains why the block that configure accepts can resolve the config character. Note that class_eval is another piece of rubyist magic that does this job: it re-installs the symbol of the passed self block into the call site class.
Check out the comments in the first file under the “Download Process” section, which explains where, how, and in what order all this kindness happens, including how the /config/environments directory is handled.
Tom harrison jr
source share