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
This commit is contained in:
Javi Martín
2024-03-28 22:42:01 +01:00
parent a8047a96c8
commit 726d8a8935
2 changed files with 4 additions and 5 deletions

View File

@@ -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

View File

@@ -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