From 82c3c6646d2d66a89adb139ee5fb17239a8f7a1a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Javi=20Mart=C3=ADn?= Date: Mon, 15 Apr 2024 16:53:05 +0200 Subject: [PATCH] Use Rails 7.1 cache format Just like we mentioned in commit 001eee3d6, 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 | 11 +++++++++++ config/initializers/new_framework_defaults_7_1.rb | 15 --------------- 2 files changed, 11 insertions(+), 15 deletions(-) diff --git a/config/application.rb b/config/application.rb index ff3b866bc..87ec9029e 100644 --- a/config/application.rb +++ b/config/application.rb @@ -38,6 +38,17 @@ module Consul # of the bootsnap cache if you use it. config.add_autoload_paths_to_load_path = false + + # 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 7.0 + # applications. + # + # Only change this value after your application is fully deployed to Rails 7.1 + # and you have no plans to rollback. + config.active_support.cache_format_version = 7.1 + # 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_1.rb b/config/initializers/new_framework_defaults_7_1.rb index 69e065018..22d75dff7 100644 --- a/config/initializers/new_framework_defaults_7_1.rb +++ b/config/initializers/new_framework_defaults_7_1.rb @@ -216,21 +216,6 @@ Rails.application.config.active_record.commit_transaction_on_non_local_return = #++ Rails.application.config.active_record.generate_secure_token_on = :initialize -### -# ** 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 7.0 -# applications. -# -# Only change this value after your application is fully deployed to Rails 7.1 -# 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.1 - ### # Configure Action View to use HTML5 standards-compliant sanitizers when they are supported on your