From 586a991830329dd96c0755c61af5723b613bf2fb Mon Sep 17 00:00:00 2001 From: Guillermo Iguaran Date: Wed, 3 Oct 2012 16:43:39 -0500 Subject: config.action_dispatch.rack_cache should set explicitly to enable Rack::Cache --- railties/lib/rails/application.rb | 9 +++++++++ .../rails/app/templates/config/environments/production.rb.tt | 5 +++++ 2 files changed, 14 insertions(+) (limited to 'railties/lib') diff --git a/railties/lib/rails/application.rb b/railties/lib/rails/application.rb index c8a6600da9..b30e6ff615 100644 --- a/railties/lib/rails/application.rb +++ b/railties/lib/rails/application.rb @@ -297,6 +297,15 @@ module Rails error.message << ' Be sure to add rack-cache to your Gemfile' raise end + + if rack_cache == true + rack_cache = { + :metastore => "rails:/", + :entitystore => "rails:/", + :verbose => false + } + end + require "action_dispatch/http/rack_cache" middleware.use ::Rack::Cache, rack_cache end diff --git a/railties/lib/rails/generators/rails/app/templates/config/environments/production.rb.tt b/railties/lib/rails/generators/rails/app/templates/config/environments/production.rb.tt index cb3e8b123e..3629920c30 100644 --- a/railties/lib/rails/generators/rails/app/templates/config/environments/production.rb.tt +++ b/railties/lib/rails/generators/rails/app/templates/config/environments/production.rb.tt @@ -14,6 +14,11 @@ config.consider_all_requests_local = false config.action_controller.perform_caching = true + # Enable Rack::Cache to put a simple HTTP cache in front of your application + # Add `rack-cache` to your Gemfile before enabling this. + # For large-scale production use, consider using a caching reverse proxy like nginx, varnish or squid. + # config.action_dispatch.rack_cache = true + # Disable Rails's static asset server (Apache or nginx will already do this). config.serve_static_assets = false -- cgit v1.2.3