From 3ba6bc1720573e74f408b63425bc872037b74b92 Mon Sep 17 00:00:00 2001 From: fraul Date: Wed, 12 Jun 2024 17:15:02 -0300 Subject: [PATCH] Update the upgrade guides for Rails 7.1 regarding the breaking change (in development/test environments) of the location of secret_key_base (#52083) Co-authored-by: Felipe --- guides/source/upgrading_ruby_on_rails.md | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/guides/source/upgrading_ruby_on_rails.md b/guides/source/upgrading_ruby_on_rails.md index 786bb74cf55..0d74dcf7ced 100644 --- a/guides/source/upgrading_ruby_on_rails.md +++ b/guides/source/upgrading_ruby_on_rails.md @@ -102,6 +102,18 @@ Upgrading from Rails 7.0 to Rails 7.1 For more information on changes made to Rails 7.1 please see the [release notes](7_1_release_notes.html). +### Development and test environments secret_key_base file changed + +In development and test environments, the file from which Rails reads the `secret_key_base` has been renamed from `tmp/development_secret.txt` to `tmp/local_secret.txt`. + +You can simply rename the previous file to `local_secret.txt` to continue using the same secret, or copy the key from the previous file to the new one. + +Failure to do so will cause Rails to generate a new secret key in the new file `tmp/local_secret.txt` when the app loads. + +This will invalidate all existing sessions/cookies in development and test environments, and also cause other signatures derived from `secret_key_base` to break, such as Active Storage/Action Text attachments. + +Production and other environments are not affected. + ### Autoloaded paths are no longer in $LOAD_PATH Starting from Rails 7.1, the directories managed by the autoloaders are no