diff options
Diffstat (limited to 'railties/lib/rails/application.rb')
-rw-r--r-- | railties/lib/rails/application.rb | 33 |
1 files changed, 18 insertions, 15 deletions
diff --git a/railties/lib/rails/application.rb b/railties/lib/rails/application.rb index 94819820bc..dd01bbab1d 100644 --- a/railties/lib/rails/application.rb +++ b/railties/lib/rails/application.rb @@ -50,6 +50,7 @@ module Rails end end + attr_accessor :assets delegate :default_url_options, :default_url_options=, :to => :routes # This method is called just after an application inherits from Rails::Application, @@ -111,18 +112,15 @@ module Rails def load_console(sandbox=false) initialize_console(sandbox) - railties.all { |r| r.load_console } + railties.all { |r| r.load_console(sandbox) } super() self end - alias :build_middleware_stack :app - def env_config @env_config ||= super.merge({ "action_dispatch.parameter_filter" => config.filter_parameters, "action_dispatch.secret_token" => config.secret_token, - "action_dispatch.asset_path" => nil, "action_dispatch.show_exceptions" => config.action_dispatch.show_exceptions }) end @@ -139,21 +137,24 @@ module Rails protected - def default_asset_path - nil - end + alias :build_middleware_stack :app def default_middleware_stack ActionDispatch::MiddlewareStack.new.tap do |middleware| - rack_cache = config.action_controller.perform_caching && config.action_dispatch.rack_cache + if rack_cache = config.action_controller.perform_caching && config.action_dispatch.rack_cache + require "action_dispatch/http/rack_cache" + middleware.use ::Rack::Cache, rack_cache + end - require "action_dispatch/http/rack_cache" if rack_cache - middleware.use ::Rack::Cache, rack_cache if rack_cache + if config.force_ssl + require "rack/ssl" + middleware.use ::Rack::SSL + end if config.serve_static_assets - asset_paths = ActiveSupport::OrderedHash[config.static_asset_paths.to_a.reverse] - middleware.use ::ActionDispatch::Static, asset_paths + middleware.use ::ActionDispatch::Static, paths["public"].first, config.static_cache_control end + middleware.use ::Rack::Lock unless config.allow_concurrency middleware.use ::Rack::Runtime middleware.use ::Rails::Rack::Logger @@ -174,7 +175,10 @@ module Rails middleware.use ::ActionDispatch::Head middleware.use ::Rack::ConditionalGet middleware.use ::Rack::ETag, "no-cache" - middleware.use ::ActionDispatch::BestStandardsSupport, config.action_dispatch.best_standards_support if config.action_dispatch.best_standards_support + + if config.action_dispatch.best_standards_support + middleware.use ::ActionDispatch::BestStandardsSupport, config.action_dispatch.best_standards_support + end end end @@ -192,8 +196,7 @@ module Rails def initialize_console(sandbox=false) require "rails/console/app" - require "rails/console/sandbox" if sandbox require "rails/console/helpers" end end -end +end
\ No newline at end of file |