From 077faa2ad0117184b5cc0477c6eafdca36f224a3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Javi=20Mart=C3=ADn?= Date: Thu, 28 Mar 2024 22:12:28 +0100 Subject: [PATCH] Move cookies serializer option to Rails 7.0 file We're moving it here so it's easier to remove it when we start using the default Rails 7.0 options and will no longer need to specify it. --- config/initializers/cookies_serializer.rb | 5 ----- .../new_framework_defaults_7_0.rb | 19 +------------------ 2 files changed, 1 insertion(+), 23 deletions(-) delete mode 100644 config/initializers/cookies_serializer.rb diff --git a/config/initializers/cookies_serializer.rb b/config/initializers/cookies_serializer.rb deleted file mode 100644 index 5a6a32d37..000000000 --- a/config/initializers/cookies_serializer.rb +++ /dev/null @@ -1,5 +0,0 @@ -# Be sure to restart your server when you modify this file. - -# Specify a serializer for the signed and encrypted cookie jars. -# Valid options are :json, :marshal, and :hybrid. -Rails.application.config.action_dispatch.cookies_serializer = :json diff --git a/config/initializers/new_framework_defaults_7_0.rb b/config/initializers/new_framework_defaults_7_0.rb index cbd23a7ce..488587cfe 100644 --- a/config/initializers/new_framework_defaults_7_0.rb +++ b/config/initializers/new_framework_defaults_7_0.rb @@ -97,26 +97,9 @@ Rails.application.config.action_dispatch.default_headers = { # If you're upgrading and haven't set `cookies_serializer` previously, your cookie serializer # is `:marshal`. The default for new apps is `:json`. # -# Rails.application.config.action_dispatch.cookies_serializer = :json -# -# -# To migrate an existing application to the `:json` serializer, use the `:hybrid` option. -# -# Rails transparently deserializes existing (Marshal-serialized) cookies on read and -# re-writes them in the JSON format. -# -# It is fine to use `:hybrid` long term; you should do that until you're confident *all* your cookies -# have been converted to JSON. To keep using `:hybrid` long term, move this config to its own -# initializer or to `config/application.rb`. -# -# Rails.application.config.action_dispatch.cookies_serializer = :hybrid -# -# -# If your cookies can't yet be serialized to JSON, keep using `:marshal` for backward-compatibility. -# # If you have configured the serializer elsewhere, you can remove this section of the file. # -# See https://guides.rubyonrails.org/action_controller_overview.html#cookies for more information. +Rails.application.config.action_dispatch.cookies_serializer = :json # Change the return value of `ActionDispatch::Request#content_type` to the Content-Type header without modification. # Rails.application.config.action_dispatch.return_only_request_media_type_on_content_type = false