From 57980ba82ab0828d5989272748e49c94ef2608e8 Mon Sep 17 00:00:00 2001 From: Shinya Kitamura Date: Wed, 1 Jun 2016 14:44:35 +0800 Subject: [PATCH] Add public_file_server setting for Rails5 --- test/rails_app/config/environments/production.rb | 4 +++- test/rails_app/config/environments/test.rb | 11 +++++------ 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/test/rails_app/config/environments/production.rb b/test/rails_app/config/environments/production.rb index 6a13ede1..bb2d0504 100644 --- a/test/rails_app/config/environments/production.rb +++ b/test/rails_app/config/environments/production.rb @@ -20,7 +20,9 @@ RailsApp::Application.configure do # config.action_dispatch.rack_cache = true # Disable Rails's static asset server (Apache or nginx will already do this). - if Rails.version >= "4.2.0" + if Rails.version >= "5.0.0" + config.public_file_server.enabled = false + elsif Rails.version >= "4.2.0" config.serve_static_files = false else config.serve_static_assets = false diff --git a/test/rails_app/config/environments/test.rb b/test/rails_app/config/environments/test.rb index b2f9f320..14732973 100644 --- a/test/rails_app/config/environments/test.rb +++ b/test/rails_app/config/environments/test.rb @@ -14,15 +14,14 @@ RailsApp::Application.configure do # Disable serving static files from the `/public` folder by default since # Apache or NGINX already handles this. - if Rails.version >= "4.2.0" + if Rails.version >= "5.0.0" + config.public_file_server.enabled = true + config.public_file_server.headers = {'Cache-Control' => 'public, max-age=3600'} + elsif Rails.version >= "4.2.0" config.serve_static_files = true + config.static_cache_control = "public, max-age=3600" else config.serve_static_assets = true - end - - if Rails.version >= "5.0.0" - config.public_file_server.headers = {'Cache-Control' => 'public, max-age=3600'} - else config.static_cache_control = "public, max-age=3600" end