Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ActiveSupport::Deprecation singleton was deprecated in 7.1, not 7.2 #407

Conversation

brandoncc
Copy link
Contributor

@brandoncc brandoncc commented Oct 30, 2024

ActiveResource 6.1.2 included a custom deprecator which uses an instance of ActiveSupport::Deprecation rather than the singleton in Rails >= 7.2. That is because of this deprecation in ActiveSupport.

The deprecation was actually shipped in Rails 7.1.0.beta1, so the condition should be on Rails >= 7.1.

image

The incorrect condition is causing CI for updates including ActiveResource >= 6.1.2 to fail with:

ActiveSupport::DeprecationException: DEPRECATION WARNING: Calling behavior= on ActiveSupport::Deprecation is deprecated and will be removed from Rails (use Rails.application.deprecators.behavior= instead) (called from <main> at /app/config/environment.rb:8) (ActiveSupport::DeprecationException)
--
  | /app/config/environment.rb:8:in `<main>'

There are also two commits which fix CI.

@@ -47,7 +50,7 @@ module ActiveResource
autoload :Validations
autoload :Collection

if ActiveSupport::VERSION::STRING >= "7.2"
if ActiveSupport::VERSION::STRING >= "7.1"
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is the actual bug fix.

Comment on lines 77 to 64
- ruby: "3.1"
env:
BRANCH: main
experimental: true
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Rails main doesn't support Ruby 3.1 anymore.

@brandoncc brandoncc force-pushed the brandoncc/fix-active-support-deprecation-version-condition branch 3 times, most recently from 006fdeb to 2ef69c6 Compare October 30, 2024 19:13
Copy link
Member

@skipkayhil skipkayhil left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

cc @byroot

Comment on lines 3 to 4
# Only necessary as long as Ruby 2.6 compatibility is maintained
require "ruby2_keywords"
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this be wrapped in a condition for Ruby < 2.7? It seems to be a no-op in Ruby 3, but I don't know if there is a performance impact to be concerned about:

irb(main):001> require "ruby2_keywords"
=> false

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm also concerned about making keywords available in tests but not in the whole gem. Is that an okay approach? Should 2.6 support be dropped, or should the require be gem-wide?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do you need this? I don't see any call to ruby2_keywords, and even if there was, it's simpler to do ruby2_keywords :foo if respond_to?(:ruby2_keywords, true) than to pull that dependency.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see, only a problem on 6-0-stable that has been EOL forever, we should drop Rails < 7.

@byroot byroot force-pushed the brandoncc/fix-active-support-deprecation-version-condition branch from 2ef69c6 to b1a0258 Compare October 31, 2024 10:19
@byroot byroot force-pushed the brandoncc/fix-active-support-deprecation-version-condition branch from b1a0258 to 299d302 Compare October 31, 2024 10:21
@byroot byroot merged commit 820f3ac into rails:main Oct 31, 2024
10 checks passed
@brandoncc brandoncc deleted the brandoncc/fix-active-support-deprecation-version-condition branch October 31, 2024 15:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants