From 726d8a8935a261541f69d8be78aa3956613e2aae Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Javi=20Mart=C3=ADn?= Date: Thu, 28 Mar 2024 22:42:01 +0100 Subject: [PATCH] Disable Rails' deprecated to_s override This option was deprecated in Rails 7.0 and removed in Rails 7.1 [1]. It doesn't really affect us because we weren't using `to_s` with a parameter anywhere in the application. The Rubocop rule Rails/ToSWithArgument can be used to detect these cases but, since we've never used them, and adding them now would cause the application to crash and so it'll be obvious we've done something wrong, I don't think it's necessary to add the rule. [1] https://github.com/rails/rails/commit/e420c3380 --- config/application.rb | 4 ++++ config/initializers/new_framework_defaults_7_0.rb | 5 ----- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/config/application.rb b/config/application.rb index 0c19b18c8..872130418 100644 --- a/config/application.rb +++ b/config/application.rb @@ -30,6 +30,10 @@ module Consul # and you have no plans to rollback. config.active_support.cache_format_version = 7.0 + # Disables the deprecated #to_s override in some Ruby core classes + # See https://guides.rubyonrails.org/configuring.html#config-active-support-disable-to-s-conversion for more information. + config.active_support.disable_to_s_conversion = true + # 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 8ffa00cba..3d86cc89c 100644 --- a/config/initializers/new_framework_defaults_7_0.rb +++ b/config/initializers/new_framework_defaults_7_0.rb @@ -108,8 +108,3 @@ Rails.application.config.action_dispatch.return_only_request_media_type_on_conte # Thus, to support submitting an empty collection, the `file_field` helper will render an hidden field `include_hidden` by default when `multiple_file_field_include_hidden` is set to `true`. # See https://guides.rubyonrails.org/configuring.html#config-active-storage-multiple-file-field-include-hidden for more information. Rails.application.config.active_storage.multiple_file_field_include_hidden = true - -# ** Please read carefully, this must be configured in config/application.rb (NOT this file) ** -# Disables the deprecated #to_s override in some Ruby core classes -# See https://guides.rubyonrails.org/configuring.html#config-active-support-disable-to-s-conversion for more information. -# config.active_support.disable_to_s_conversion = true