to_s(:db) has been deprecated and the alias to to_fs has been removed#106
Closed
carsonbenson-mx wants to merge 1 commit intoliveh2o:mainfrom
Closed
to_s(:db) has been deprecated and the alias to to_fs has been removed#106carsonbenson-mx wants to merge 1 commit intoliveh2o:mainfrom
carsonbenson-mx wants to merge 1 commit intoliveh2o:mainfrom
Conversation
… in Rails 7.1, creating an incompatibility
mattnichols
approved these changes
Jul 21, 2025
Contributor
Author
|
Closing and recreating the PR as it is easier to create a new branch off the desired target branch of 7-1-stable. |
|
Moved to #107 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
to_s(:db) has been deprecated and the alias to to_fs has been removed in Rails 7.1, creating an incompatibility.
Last week I found what I believe to be a Rails 7.1 incompatibility in ActiveRemote when running some search calls from a Rails console:
It looks like to_s(:db) for Date and Time objects had been deprecated for a while, but Rails had been aliasing to_s(arg) to the new, preferred to_fs or to_formatted_s methods right up until Rails 7. In older versions of Rails active_support/core_ext/date_time/conversions.rb, we had an alias for :to_s -> :to_formatted_s
(https://github.com/rails/rails/blob/v6.1.0/activesupport/lib/active_support/core_ext/date_time/conversions.rb#L42C1-L44C1)
That alias no longer exists in v7.1.5.1:
https://github.com/rails/rails/blob/v7.1.5.1/activesupport/lib/active_support/core_ext/date_time/conversions.rb
This PR merely changes the call to
to_s(:db)in attribute_methods to use the non-deprecatedto_fs.