diff options
author | Carlhuda <carlhuda@engineyard.com> | 2010-03-03 15:23:39 -0800 |
---|---|---|
committer | Carlhuda <carlhuda@engineyard.com> | 2010-03-03 15:49:24 -0800 |
commit | 9731c5213b9f1a46c478da862b43cbf708da40da (patch) | |
tree | a51ea38502e985ad9f2afef02b299c24bd3acd10 /railties/lib | |
parent | 29158d4158e9ae800c5be31a796940888bd03cc5 (diff) | |
download | rails-9731c5213b9f1a46c478da862b43cbf708da40da.tar.gz rails-9731c5213b9f1a46c478da862b43cbf708da40da.tar.bz2 rails-9731c5213b9f1a46c478da862b43cbf708da40da.zip |
Don't rely on Rails.application global state in Config
Diffstat (limited to 'railties/lib')
-rw-r--r-- | railties/lib/rails/application.rb | 4 | ||||
-rw-r--r-- | railties/lib/rails/configuration.rb | 16 | ||||
-rw-r--r-- | railties/lib/rails/engine.rb | 2 |
3 files changed, 11 insertions, 11 deletions
diff --git a/railties/lib/rails/application.rb b/railties/lib/rails/application.rb index a74550b302..d9089b18f0 100644 --- a/railties/lib/rails/application.rb +++ b/railties/lib/rails/application.rb @@ -55,10 +55,6 @@ module Rails @railties ||= Railties.new(config) end - def metal_loader - @metal_loader ||= MetalLoader.new - end - def routes_reloader @routes_reloader ||= RoutesReloader.new end diff --git a/railties/lib/rails/configuration.rb b/railties/lib/rails/configuration.rb index bcd98c67f8..a1e901f04f 100644 --- a/railties/lib/rails/configuration.rb +++ b/railties/lib/rails/configuration.rb @@ -50,6 +50,10 @@ module Rails super || name.to_s =~ config_key_regexp end + def metal_loader + @metal_loader ||= Rails::Application::MetalLoader.new + end + private def method_missing(name, *args, &blk) @@ -75,17 +79,17 @@ module Rails def default_middleware require 'action_dispatch' ActionDispatch::MiddlewareStack.new.tap do |middleware| - middleware.use('::ActionDispatch::Static', lambda { Rails.public_path }, :if => lambda { Rails.application.config.serve_static_assets }) - middleware.use('::Rack::Lock', :if => lambda { !Rails.application.config.allow_concurrency }) + middleware.use('::ActionDispatch::Static', lambda { Rails.public_path }, :if => lambda { serve_static_assets }) + middleware.use('::Rack::Lock', :if => lambda { !allow_concurrency }) middleware.use('::Rack::Runtime') middleware.use('::Rails::Rack::Logger') - middleware.use('::ActionDispatch::ShowExceptions', lambda { Rails.application.config.consider_all_requests_local }) - middleware.use('::Rack::Sendfile', lambda { Rails.application.config.action_dispatch.x_sendfile_header }) - middleware.use('::ActionDispatch::Callbacks', lambda { !Rails.application.config.cache_classes }) + middleware.use('::ActionDispatch::ShowExceptions', lambda { consider_all_requests_local }) + middleware.use('::Rack::Sendfile', lambda { action_dispatch.x_sendfile_header }) + middleware.use('::ActionDispatch::Callbacks', lambda { !cache_classes }) middleware.use('::ActionDispatch::Cookies') middleware.use(lambda { ActionController::Base.session_store }, lambda { ActionController::Base.session_options }) middleware.use('::ActionDispatch::Flash', :if => lambda { ActionController::Base.session_store }) - middleware.use(lambda { Rails.application.metal_loader.build_middleware(Rails.application.config.metals) }, :if => lambda { Rails.application.metal_loader.metals.any? }) + middleware.use(lambda { metal_loader.build_middleware(metals) }, :if => lambda { metal_loader.metals.any? }) middleware.use('ActionDispatch::ParamsParser') middleware.use('::Rack::MethodOverride') middleware.use('::ActionDispatch::Head') diff --git a/railties/lib/rails/engine.rb b/railties/lib/rails/engine.rb index 79183480a3..f5cce857a2 100644 --- a/railties/lib/rails/engine.rb +++ b/railties/lib/rails/engine.rb @@ -41,7 +41,7 @@ module Rails end end - delegate :middleware, :paths, :root, :to => :config + delegate :middleware, :paths, :metal_loader, :root, :to => :config def load_tasks super |