Fix Issue #1465: Rails 7.2 ActiveSupport::Deprecation compatibility#19
Merged
takaokouji merged 1 commit intomasterfrom Jan 21, 2026
Merged
Conversation
…n compatibility Issue JSONAPI-Resources#1465 reported NoMethodError when calling ActiveSupport::Deprecation.warn in Rails 7.2, which made this method private. Changes: - Updated JSONAPI.warn_deprecated to use try/rescue approach - Rails < 7.2: Calls ActiveSupport::Deprecation.warn as class method - Rails 7.2+: Creates Deprecation instance and calls warn on it - Fallback: Uses Kernel#warn for environments without ActiveSupport The fix ensures backward compatibility while supporting Rails 7.2+. Tests added to verify the deprecation warning system works correctly across different Rails versions. Related: https://github.com/cerebris/jsonapi-resources/issues/1465
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.
Summary
Fixes JSONAPI-Resources#1465 by updating the deprecation warning system to be compatible with Rails 7.2, which made
ActiveSupport::Deprecation.warna private method.Problem
In Rails 7.2, calling
ActiveSupport::Deprecation.warnas a class method raises:This breaks deprecation warnings throughout the gem, causing failures during
rails app:updateand normal operation.Root Cause
Rails 7.2 changed
ActiveSupport::Deprecation.warnfrom a public class method to a private method, requiring users to instantiate the Deprecation class first.Solution
Updated
JSONAPI.warn_deprecatedhelper to:Testing
Related
🤖 Generated with Claude Code