diff options
Diffstat (limited to 'railties/lib/rails/application')
4 files changed, 18 insertions, 24 deletions
diff --git a/railties/lib/rails/application/configuration.rb b/railties/lib/rails/application/configuration.rb index 786dcee007..dc3ec4274b 100644 --- a/railties/lib/rails/application/configuration.rb +++ b/railties/lib/rails/application/configuration.rb @@ -6,12 +6,12 @@ require 'rails/source_annotation_extractor' module Rails class Application class Configuration < ::Rails::Engine::Configuration - attr_accessor :allow_concurrency, :asset_host, :assets, :autoflush_log, + attr_accessor :allow_concurrency, :asset_host, :autoflush_log, :cache_classes, :cache_store, :consider_all_requests_local, :console, :eager_load, :exceptions_app, :file_watcher, :filter_parameters, :force_ssl, :helpers_paths, :logger, :log_formatter, :log_tags, :railties_order, :relative_url_root, :secret_key_base, :secret_token, - :serve_static_assets, :ssl_options, :static_cache_control, :session_options, + :serve_static_files, :ssl_options, :static_cache_control, :session_options, :time_zone, :reload_classes_only_on_change, :beginning_of_week, :filter_redirect, :x @@ -26,7 +26,7 @@ module Rails @filter_parameters = [] @filter_redirect = [] @helpers_paths = [] - @serve_static_assets = true + @serve_static_files = true @static_cache_control = nil @force_ssl = false @ssl_options = {} @@ -49,21 +49,6 @@ module Rails @secret_token = nil @secret_key_base = nil @x = Custom.new - - @assets = ActiveSupport::OrderedOptions.new - @assets.enabled = true - @assets.paths = [] - @assets.precompile = [ Proc.new { |path, fn| fn =~ /app\/assets/ && !%w(.js .css).include?(File.extname(path)) }, - /(?:\/|\\|\A)application\.(css|js)$/ ] - @assets.prefix = "/assets" - @assets.version = '1.0' - @assets.debug = false - @assets.compile = true - @assets.digest = false - @assets.cache_store = [ :file_store, "#{root}/tmp/cache/assets/#{Rails.env}/" ] - @assets.js_compressor = nil - @assets.css_compressor = nil - @assets.logger = nil end def encoding=(value) @@ -118,7 +103,7 @@ module Rails end def log_level - @log_level ||= :debug + @log_level ||= (Rails.env.production? ? :info : :debug) end def colorize_logging diff --git a/railties/lib/rails/application/default_middleware_stack.rb b/railties/lib/rails/application/default_middleware_stack.rb index a00afe008c..02eea82b0c 100644 --- a/railties/lib/rails/application/default_middleware_stack.rb +++ b/railties/lib/rails/application/default_middleware_stack.rb @@ -17,7 +17,7 @@ module Rails middleware.use ::Rack::Sendfile, config.action_dispatch.x_sendfile_header - if config.serve_static_assets + if config.serve_static_files middleware.use ::ActionDispatch::Static, paths["public"].first, config.static_cache_control end @@ -66,7 +66,11 @@ module Rails end def allow_concurrency? - config.allow_concurrency.nil? ? config.cache_classes : config.allow_concurrency + if config.allow_concurrency.nil? + config.cache_classes && config.eager_load + else + config.allow_concurrency + end end def load_rack_cache diff --git a/railties/lib/rails/application/finisher.rb b/railties/lib/rails/application/finisher.rb index 7a1bb1e25c..0599e988d9 100644 --- a/railties/lib/rails/application/finisher.rb +++ b/railties/lib/rails/application/finisher.rb @@ -108,6 +108,13 @@ module Rails ActionDispatch::Reloader.to_cleanup(&callback) end end + + # Disable dependency loading during request cycle + initializer :disable_dependency_loading do + if config.eager_load && config.cache_classes + ActiveSupport::Dependencies.unhook! + end + end end end end diff --git a/railties/lib/rails/application/routes_reloader.rb b/railties/lib/rails/application/routes_reloader.rb index 737977adf9..cf0a4e128f 100644 --- a/railties/lib/rails/application/routes_reloader.rb +++ b/railties/lib/rails/application/routes_reloader.rb @@ -41,9 +41,7 @@ module Rails end def finalize! - route_sets.each do |routes| - routes.finalize! - end + route_sets.each(&:finalize!) end def revert |