From 8fee1515f6f647717e6190811960fdc36477ede7 Mon Sep 17 00:00:00 2001 From: Jon Atack Date: Thu, 5 Nov 2015 12:14:09 +0100 Subject: Fix `static_cache_control` deprecation warning 1. Fix the message by wrapping the value in missing quotes and adding the missing backtick at the end. Finally, :lipstick: by adding a space inside the curly braces. Before: `config.public_file_server.headers = {'Cache-Control' => public, max-age=31536000} Now: `config.public_file_server.headers = { 'Cache-Control' => 'public, max-age=31536000' }` 2. Display `static_cache_control` instead of static_cache_control. This follows what the 2 neighboring methods are doing. 3. Use strip_heredoc to improve the code formatting and readability like the 2 neighboring methods and wrap to 80 characters. --- railties/lib/rails/application/configuration.rb | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'railties') diff --git a/railties/lib/rails/application/configuration.rb b/railties/lib/rails/application/configuration.rb index 7ac010b903..785671f70b 100644 --- a/railties/lib/rails/application/configuration.rb +++ b/railties/lib/rails/application/configuration.rb @@ -56,9 +56,12 @@ module Rails end def static_cache_control=(value) - ActiveSupport::Deprecation.warn("static_cache_control is deprecated and will be removed in Rails 5.1. " \ - "Please use `config.public_file_server.headers = {'Cache-Control' => #{value}} " \ - "instead.") + ActiveSupport::Deprecation.warn <<-eow.strip_heredoc + `static_cache_control` is deprecated and will be removed in Rails 5.1. + Please use + `config.public_file_server.headers = { 'Cache-Control' => '#{value}' }` + instead. + eow @static_cache_control = value end -- cgit v1.2.3