Deprecate ActiveSupport::ProxyObject#51638
Merged
rafaelfranca merged 1 commit intorails:mainfrom Apr 22, 2024
Merged
Conversation
A historic leftover from when Ruby didn't have `BasicObject`
Member
|
Thanks! |
This was referenced Apr 23, 2024
Member
|
This is used by jbuilder, and BasicObject is not a drop-in replacement. Jbuilder is a default gem, and it's throwing deprecations now. That's not going to work. I don't think the deprecation here is worth it. |
Member
|
(Still think we ought to be careful with deprecations like this. It may well be used in a dependency that someone does not have the power to change. But whatever for now.) |
Contributor
|
Small follow up: #51688 |
|
yes |
kakeru-one
added a commit
to Progaku-copy/progaku-archive
that referenced
this pull request
Sep 10, 2024
Hurchan
added a commit
to Hurchan/prototype-rails
that referenced
this pull request
Feb 4, 2025
zokioki
added a commit
to doximity/es-elasticity
that referenced
this pull request
Aug 26, 2025
The use of `ActiveSupport::ProxyObject` was deprecated via [1] and was fully removed in Rails 8.0. This updates the code to switch from ProxyObject to Ruby's built-in `BasicObject` [2]. The `BasicObject` has been available in Ruby since v1.9, and given that this gem has direct dependencies on activemodel/activesupport/ activerecord >= 5.2.0 which themselves require a minimum Ruby version of 2.2 [3], this shouldn't introduce breaking changes for the range of Ruby versions currently allowed by this gem. Additionally, the `raise` method that was defined by `ProxyObject` [4] was not being leveraged in the gem's code, so this should be a clean replacement, however, we can define `raise` for these classes if we want to be extra conservative with the change. [1] rails/rails#51638 [2] https://docs.ruby-lang.org/en/3.4/BasicObject.html [3] https://rubygems.org/gems/activemodel/versions/5.2.0 [4] https://github.com/rails/rails/blob/6f0d1ad14b92b9f5906e44740fce8b4f1c7075dc/activesupport/lib/active_support/proxy_object.rb#L13-L15
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.
Motivation / Background
Let's give this a try: #51632 (comment). cc @carlosantoniodasilva
This class had its uses in Ruby 1.8 times when
BasicObjectdidn't exist yet, nowadays it is jus a wrapper.The last internal usage was removed about 10 years ago in #16574.
Rails used to ship with a dependecy on the
buildergem, which was (probably among other things) used to backportBasicObjectto Ruby 1.8: 34b5767Detail
Deprecate
ActiveSupport::ProxyObject.Additional information
There are a few uses in rails related projects. I plan to make PRs against
jbuilderandactiveresourceif this is accepted.Checklist
Before submitting the PR make sure the following are checked:
[Fix #issue-number]