aboutsummaryrefslogtreecommitdiffstats
path: root/railties/lib
diff options
context:
space:
mode:
Diffstat (limited to 'railties/lib')
-rw-r--r--railties/lib/initializer.rb10
-rw-r--r--railties/lib/rails_generator/generators/applications/app/app_generator.rb1
2 files changed, 11 insertions, 0 deletions
diff --git a/railties/lib/initializer.rb b/railties/lib/initializer.rb
index a3ab73fd51..b535c8624b 100644
--- a/railties/lib/initializer.rb
+++ b/railties/lib/initializer.rb
@@ -70,6 +70,8 @@ module Rails
# * #load_plugins
# * #load_observers
# * #initialize_routing
+ # * #after_initialize
+ # * #load_application_initializers
#
# (Note that #load_environment is invoked twice, once at the start and
# once at the end, to support the legacy configuration style where the
@@ -112,6 +114,8 @@ module Rails
# the framework is now fully initialized
after_initialize
+
+ load_application_initializers
end
# Check for valid Ruby version
@@ -334,6 +338,12 @@ module Rails
configuration.after_initialize_block.call if configuration.after_initialize_block
end
+ def load_application_initializers
+ Dir["#{RAILS_ROOT}/config/initializers/**/*.rb"].each do |initializer|
+ load(initializer)
+ end
+ end
+
protected
# Return a list of plugin paths within base_path. A plugin path is
# a directory that contains either a lib directory or an init.rb file.
diff --git a/railties/lib/rails_generator/generators/applications/app/app_generator.rb b/railties/lib/rails_generator/generators/applications/app/app_generator.rb
index 4c8ffc7502..01fff050ed 100644
--- a/railties/lib/rails_generator/generators/applications/app/app_generator.rb
+++ b/railties/lib/rails_generator/generators/applications/app/app_generator.rb
@@ -121,6 +121,7 @@ class AppGenerator < Rails::Generator::Base
app/models
app/views/layouts
config/environments
+ config/initializers
db
doc
lib