diff options
author | José Valim <jose.valim@gmail.com> | 2010-01-23 17:13:25 +0100 |
---|---|---|
committer | José Valim <jose.valim@gmail.com> | 2010-01-23 17:13:25 +0100 |
commit | 924fa084e81b8b2f5ae9eab93d6b711c2b6b89d8 (patch) | |
tree | 877c0c8305297d938c57c55c716666869648857a /railties/lib/rails/engine.rb | |
parent | 13d66cdf2544af0d465d596383743b16b5005996 (diff) | |
download | rails-924fa084e81b8b2f5ae9eab93d6b711c2b6b89d8.tar.gz rails-924fa084e81b8b2f5ae9eab93d6b711c2b6b89d8.tar.bz2 rails-924fa084e81b8b2f5ae9eab93d6b711c2b6b89d8.zip |
First steps into making Plugin < Engine.
Diffstat (limited to 'railties/lib/rails/engine.rb')
-rw-r--r-- | railties/lib/rails/engine.rb | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/railties/lib/rails/engine.rb b/railties/lib/rails/engine.rb index cf6ca7c3f5..b11c1ac73e 100644 --- a/railties/lib/rails/engine.rb +++ b/railties/lib/rails/engine.rb @@ -42,6 +42,10 @@ module Rails delegate :middleware, :paths, :root, :config, :to => :'self.class' + def reloadable?(app) + app.config.reload_plugins + end + # Add configured load paths to ruby load paths and remove duplicates. initializer :set_load_path do config.load_paths.reverse_each do |path| @@ -52,21 +56,17 @@ module Rails # Set the paths from which Rails will automatically load source files, # and the load_once paths. - initializer :set_autoload_paths do + initializer :set_autoload_paths do |app| ActiveSupport::Dependencies.load_paths.concat(config.load_paths) - ActiveSupport::Dependencies.load_once_paths.concat(config.load_once_paths) - - extra = ActiveSupport::Dependencies.load_once_paths - - ActiveSupport::Dependencies.load_paths - unless extra.empty? - abort <<-end_error - load_once_paths must be a subset of the load_paths. - Extra items in load_once_paths: #{extra * ','} - end_error + if reloadable?(app) + ActiveSupport::Dependencies.load_once_paths.concat(config.load_once_paths) + else + ActiveSupport::Dependencies.load_once_paths.concat(config.load_paths) end # Freeze so future modifications will fail rather than do nothing mysteriously + config.load_paths.freeze config.load_once_paths.freeze end |