Skip to content

Add Rails 8.1 compatibility tests for relationship routes (Issue #1479)#22

Merged
takaokouji merged 1 commit intomasterfrom
test/rails-8.1-relationship-routes
Jan 21, 2026
Merged

Add Rails 8.1 compatibility tests for relationship routes (Issue #1479)#22
takaokouji merged 1 commit intomasterfrom
test/rails-8.1-relationship-routes

Conversation

@takaokouji
Copy link
Collaborator

Summary

Adds explicit tests to verify that Issue JSONAPI-Resources#1479 (Rails 8.1 relationship routes not generated) is fixed in the current master branch.

Issue JSONAPI-Resources#1479

  • Problem: Rails 8.1 changed ActionDispatch::Routing::Mapper::Resources::Resource#initialize to require keyword arguments
  • Impact: jsonapi_relationships was not automatically called, causing relationship routes to be missing
  • Fix: Already implemented in master (lib/jsonapi/routing_ext.rb:146-155)

Changes

  • Added 5 new routing tests for Rails 8.1 compatibility:
    • test_routing_articles_show - Basic resource route
    • test_routing_articles_relationship_comments_show - has_many relationship show route
    • test_routing_articles_relationship_comments_create - has_many relationship create route
    • test_routing_articles_relationship_comments_update - has_many relationship update route
    • test_routing_articles_relationship_comments_destroy - has_many relationship delete route
    • test_routing_article_comments_relationship_commentable_show - Polymorphic belongs_to relationship route

Test Results

All tests pass on Rails 8.1.2:

37 runs, 115 assertions, 0 failures, 0 errors, 0 skips

Related

Tests to verify Issue JSONAPI-Resources#1479 is fixed:
- Rails 8.1 changed ActionDispatch::Routing::Mapper::Resources::Resource#initialize
  to require keyword arguments
- These tests verify that jsonapi_resources generates relationship routes correctly
- Tests include has_many and polymorphic belongs_to relationships
- Confirms automatic jsonapi_relationships call works in Rails 8.1+

All 37 route tests pass on Rails 8.1.2
@takaokouji takaokouji merged commit 302fa5d into master Jan 21, 2026
60 checks passed
@takaokouji takaokouji deleted the test/rails-8.1-relationship-routes branch January 21, 2026 13:01
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.

1 participant