diff options
Diffstat (limited to 'railties')
-rw-r--r-- | railties/lib/rails/engine.rb | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/railties/lib/rails/engine.rb b/railties/lib/rails/engine.rb index e40052e0f1..a9c94bc020 100644 --- a/railties/lib/rails/engine.rb +++ b/railties/lib/rails/engine.rb @@ -57,12 +57,12 @@ module Rails # Set the paths from which Rails will automatically load source files, # and the load_once paths. initializer :set_autoload_paths do |app| - ActiveSupport::Dependencies.load_paths.concat(config.load_paths) + ActiveSupport::Dependencies.load_paths.unshift(*config.load_paths) if reloadable?(app) - ActiveSupport::Dependencies.load_once_paths.concat(config.load_once_paths) + ActiveSupport::Dependencies.load_once_paths.unshift(*config.load_once_paths) else - ActiveSupport::Dependencies.load_once_paths.concat(config.load_paths) + ActiveSupport::Dependencies.load_once_paths.unshift(*config.load_paths) end # Freeze so future modifications will fail rather than do nothing mysteriously @@ -86,18 +86,20 @@ module Rails end end + # I18n load paths are a special case since the ones added + # later have higher priority. initializer :add_locales do - config.i18n.load_path.unshift(*paths.config.locales.to_a) + config.i18n.engines_load_path.concat(paths.config.locales.to_a) end initializer :add_view_paths do views = paths.app.views.to_a - ActionController::Base.view_paths.concat(views) if defined?(ActionController) - ActionMailer::Base.view_paths.concat(views) if defined?(ActionMailer) + ActionController::Base.view_paths.unshift(*views) if defined?(ActionController) + ActionMailer::Base.view_paths.unshift(*views) if defined?(ActionMailer) end initializer :add_metals do - Rails::Rack::Metal.paths.concat(paths.app.metals.to_a) + Rails::Rack::Metal.paths.unshift(*paths.app.metals.to_a) end initializer :load_application_initializers do |