aboutsummaryrefslogtreecommitdiffstats
path: root/railties/lib/rails/configuration.rb
diff options
context:
space:
mode:
Diffstat (limited to 'railties/lib/rails/configuration.rb')
-rw-r--r--railties/lib/rails/configuration.rb25
1 files changed, 21 insertions, 4 deletions
diff --git a/railties/lib/rails/configuration.rb b/railties/lib/rails/configuration.rb
index f0a0d5e55e..c180031c61 100644
--- a/railties/lib/rails/configuration.rb
+++ b/railties/lib/rails/configuration.rb
@@ -4,11 +4,24 @@ module Rails
# Temporarily separate the plugin configuration class from the main
# configuration class while this bit is being cleaned up.
class Railtie::Configuration
-
def self.default
@default ||= new
end
+ def self.default_middleware_stack
+ 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 { !ActionController::Base.allow_concurrency })
+ middleware.use('::Rack::Runtime')
+ middleware.use('ActionDispatch::ShowExceptions', lambda { ActionController::Base.consider_all_requests_local })
+ middleware.use('ActionDispatch::Callbacks', lambda { ActionController::Dispatcher.prepare_each_request })
+ middleware.use(lambda { ActionController::Base.session_store }, lambda { ActionController::Base.session_options })
+ middleware.use('ActionDispatch::ParamsParser')
+ middleware.use('::Rack::MethodOverride')
+ middleware.use('::Rack::Head')
+ end
+ end
+
attr_reader :middleware
def initialize(base = nil)
@@ -17,7 +30,7 @@ module Rails
@middleware = base.middleware.dup
else
@options = Hash.new { |h,k| h[k] = ActiveSupport::OrderedOptions.new }
- @middleware = ActionDispatch::MiddlewareStack.new
+ @middleware = self.class.default_middleware_stack
end
end
@@ -120,8 +133,8 @@ module Rails
end
def frameworks(*args)
- raise "config.frameworks in no longer supported. See the generated" \
- "config/boot.rb for steps on how to limit the frameworks that" \
+ raise "config.frameworks in no longer supported. See the generated " \
+ "config/boot.rb for steps on how to limit the frameworks that " \
"will be loaded"
end
alias frameworks= frameworks
@@ -231,6 +244,10 @@ module Rails
@log_level ||= RAILS_ENV == 'production' ? :info : :debug
end
+ def time_zone
+ @time_zone ||= "UTC"
+ end
+
def i18n
@i18n ||= begin
i18n = ActiveSupport::OrderedOptions.new