Skip to content

Update deprecation tracker to support newer Rails versions (7.1+) #142

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

Merged
merged 2 commits into from
Feb 26, 2025

Conversation

daugaard
Copy link

Description

Since Rails 7.1 the preferred way to track deprecations is to access the deprecation trackers via Rails.application.deprecators.

Here, we change the implementation to use that if it is available, otherwise fallback to tracking deprecations via the ActiveSupport::Deprecation singleton object for older Rails versions.

Related Rails changes:

Motivation and Context

This is required to avoid getting deprecation warnings when using next_rails on Rails 7.1+ versions.

DEPRECATION WARNING: Calling behavior on ActiveSupport::Deprecation is deprecated and will be removed from Rails (use Rails.
application.deprecators[framework].behavior where framework is for example :active_record instead) (called from block in <to
p (required)> at /Users/sorendaugaard/xxxx/spec/rails_helper.rb:300)

Additionally, eventually access via the singleton will be retired, this change will ensure we can still track deprecations when that happens.

How Has This Been Tested?

I added new specs to test this functionality.

Additionally, I tested this against a Rails 7.1 project and check that we received the expected deprecation warnings.

Screenshots:

n/a

I will abide by the code of conduct

Since Rails 7.1 the preferred way to track deprecations is to use the
deprecation trackers via `Rails.application.deprecators`.

Here we change the implementation to use that if it is available,
otherwise fallback to tracking deprecations via the ActiveSupport
singleton object for older Rails versions.
@etagwerker etagwerker requested review from JuanVqz and arielj February 26, 2025 02:50
Copy link
Member

@etagwerker etagwerker left a comment

Choose a reason for hiding this comment

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

This looks good to me, thanks!

@etagwerker etagwerker merged commit 141c2f1 into fastruby:main Feb 26, 2025
8 checks passed
@JuanVqz
Copy link
Member

JuanVqz commented Feb 26, 2025

@daugaard Thanks for such contribution! 🏅

I'll release it tomorrow if @etagwerker didn't do it yet

@etagwerker
Copy link
Member

@JuanVqz I won't have time today, so tomorrow would be great. Thanks!

@JuanVqz
Copy link
Member

JuanVqz commented Feb 26, 2025

As mentioned before it has been released

https://github.com/fastruby/next_rails/releases/tag/v1.4.4

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.

3 participants