From 001eee3d6cb399500b4d37087a6ad7b8db23d60d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Javi=20Mart=C3=ADn?= Date: Thu, 28 Mar 2024 22:05:19 +0100 Subject: [PATCH] Use Rails 7.0 cache format According to the Rails configuration guide [1], with this format, Rails serializes cache entries more efficiently. Most importantly: > All formats are backward and forward compatible, meaning cache entries > written in one format can be read when using another format. This > behavior makes it easy to migrate between formats without invalidating > the entire cache. [1] https://guides.rubyonrails.org/v7.1/configuring.html#config-active-support-cache-format-version --- config/application.rb | 7 +++++++ config/initializers/new_framework_defaults_7_0.rb | 11 ----------- 2 files changed, 7 insertions(+), 11 deletions(-) diff --git a/config/application.rb b/config/application.rb index fc512ff98..0c19b18c8 100644 --- a/config/application.rb +++ b/config/application.rb @@ -23,6 +23,13 @@ module Consul class Application < Rails::Application config.load_defaults 6.1 + # Change the format of the cache entry. + # Changing this default means that all new cache entries added to the cache + # will have a different format that is not supported by Rails 6.1 applications. + # Only change this value after your application is fully deployed to Rails 7.0 + # and you have no plans to rollback. + config.active_support.cache_format_version = 7.0 + # Keep belongs_to fields optional by default, because that's the way # Rails 4 models worked config.active_record.belongs_to_required_by_default = false diff --git a/config/initializers/new_framework_defaults_7_0.rb b/config/initializers/new_framework_defaults_7_0.rb index 723b20904..cbd23a7ce 100644 --- a/config/initializers/new_framework_defaults_7_0.rb +++ b/config/initializers/new_framework_defaults_7_0.rb @@ -92,17 +92,6 @@ Rails.application.config.action_dispatch.default_headers = { "Referrer-Policy" => "strict-origin-when-cross-origin" } - -# ** Please read carefully, this must be configured in config/application.rb ** -# Change the format of the cache entry. -# Changing this default means that all new cache entries added to the cache -# will have a different format that is not supported by Rails 6.1 applications. -# Only change this value after your application is fully deployed to Rails 7.0 -# and you have no plans to rollback. -# When you're ready to change format, add this to `config/application.rb` (NOT this file): -# config.active_support.cache_format_version = 7.0 - - # Cookie serializer: 2 options # # If you're upgrading and haven't set `cookies_serializer` previously, your cookie serializer