Add Rails 8.1 compatibility improvements#24
Merged
takaokouji merged 1 commit intomasterfrom Jan 21, 2026
Merged
Conversation
9 tasks
8d877e6 to
13069e8
Compare
This commit addresses several Rails 8.1 compatibility issues: 1. **CSV gem dependency**: Added 'csv' gem to Gemfile for Rails 8.1+ (removed from standard library). Required by acts_as_resource_controller.rb. 2. **HTTP status code compatibility**: Updated :unprocessable_entity to use conditional :unprocessable_content for Rails 8.0+ to avoid deprecation warnings while maintaining backward compatibility with earlier Rails versions. - Added unprocessable_status helper in JSONAPI::Exceptions::Error - Updated ValidationErrors and SaveFailed exceptions - Updated test assertions in controller_test.rb and test helpers 3. **Database adapter improvements**: Simplified db_true helper in join_manager_test.rb to use ActiveRecord::Base.connection.quoted_true for database-agnostic boolean value handling. These changes maintain full backward compatibility with Rails 6.1, 7.0, and 7.1 while preparing for Rails 8.0+. Based on upstream PR: cerebris#1485 Co-Authored-By: Cassie Simpson <[email protected]>
13069e8 to
4a10213
Compare
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
This PR adds Rails 8.1 compatibility improvements while maintaining full backward compatibility with earlier Rails versions (6.1, 7.0, 7.1).
Based on the excellent work by @simps614 in upstream PR cerebris#1485.
Changes
1. CSV gem dependency
Gemfilecsvgem for Rails 8.1+ (removed from standard library)lib/jsonapi/acts_as_resource_controller.rb:32. HTTP status code compatibility
lib/jsonapi/exceptions.rb,test/controllers/controller_test.rb,test/test_helper.rb,test/helpers/functional_helpers.rb:unprocessable_entityto conditionally use:unprocessable_contentfor Rails 8.0+unprocessable_statushelper method inJSONAPI::Exceptions::Errorand test helpers:unprocessable_contentwhenRails::VERSION::MAJOR >= 83. Database adapter improvements
test/unit/active_relation_resource_finder/join_manager_test.rbdb_truehelper to useActiveRecord::Base.connection.quoted_trueBackward Compatibility
All changes maintain full backward compatibility:
:unprocessable_entity(existing behavior):unprocessable_content(avoids deprecation warnings)Testing
All tests pass with Rails 6.1, 7.0, 8.0, and 8.1:
Credits
Based on the work by @simps614 (Cassie Simpson) in cerebris#1485.
Related Issues