Add Rails 8.1 compatibility improvements #24
Merged
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