aboutsummaryrefslogtreecommitdiffstats
path: root/railties/lib/rails/engine.rb
diff options
context:
space:
mode:
Diffstat (limited to 'railties/lib/rails/engine.rb')
-rw-r--r--railties/lib/rails/engine.rb12
1 files changed, 7 insertions, 5 deletions
diff --git a/railties/lib/rails/engine.rb b/railties/lib/rails/engine.rb
index 8a6d1f34aa..46a6485c44 100644
--- a/railties/lib/rails/engine.rb
+++ b/railties/lib/rails/engine.rb
@@ -34,8 +34,9 @@ module Rails
# == Configuration
#
# Besides the +Railtie+ configuration which is shared across the application, in a
- # <tt>Rails::Engine</tt> you can access <tt>autoload_paths</tt> and <tt>autoload_once_paths</tt>,
- # which, differently from a <tt>Railtie</tt>, are scoped to the current engine.
+ # <tt>Rails::Engine</tt> you can access <tt>autoload_paths</tt>, <tt>eager_load_paths</tt>
+ # and <tt>autoload_once_paths</tt>, which, differently from a <tt>Railtie</tt>, are scoped to
+ # the current engine.
#
# class MyEngine < Rails::Engine
# # Add a load path for this specific Engine
@@ -455,9 +456,9 @@ module Rails
end
# Eager load the application by loading all ruby
- # files inside autoload_paths.
+ # files inside eager_load paths.
def eager_load!
- config.autoload_paths.each do |load_path|
+ config.eager_load_paths.each do |load_path|
matcher = /\A#{Regexp.escape(load_path)}\/(.*)\.rb\Z/
Dir.glob("#{load_path}/**/*.rb").sort.each do |file|
require_dependency file.sub(matcher, '\1')
@@ -557,6 +558,7 @@ module Rails
# Freeze so future modifications will fail rather than do nothing mysteriously
config.autoload_paths.freeze
+ config.eager_load_paths.freeze
config.autoload_once_paths.freeze
end
@@ -669,7 +671,7 @@ module Rails
end
def _all_autoload_paths #:nodoc:
- @_all_autoload_paths ||= (config.autoload_paths + config.autoload_once_paths).uniq
+ @_all_autoload_paths ||= (config.autoload_paths + config.eager_load_paths + config.autoload_once_paths).uniq
end
def _all_load_paths #:nodoc: