Skip to content

fix: backport Rails 8.1 routing keywords to release-0-9 - #1497

Open
barelyknown wants to merge 1 commit into
release-0-9from
codex/rails-8-1-routing-0-9
Open

barelyknown wants to merge 1 commit into
release-0-9from
codex/rails-8-1-routing-0-9

Conversation

@barelyknown

Copy link
Copy Markdown
Collaborator

Agent responds:

On release-0-9, drawing either a plural or singleton JSONAPI route under Rails 8.1 raises ArgumentError: wrong number of arguments (given 4, expected 3) in the Rails resource constructor. The calls to resource and resources also emit positional-options deprecations.

Pass the existing options as keywords at all four routing calls. This keeps the 0.9 resource and serialization contracts intact for applications upgrading Rails. Add two database-free regression tests covering plural and singleton route generation, controller options, and excluded actions.

This is a maintenance-branch backport related to #1496, which targets master; it also handles the two outer routing calls. It does not attempt the broader compatibility changes in #1480.

Validation on Ruby 3.3.8:

  • Before the fix: both tests raise the constructor argument error on Rails 8.1.4.
  • After the fix: 2 tests / 9 assertions pass on each of Rails 7.0.8.7, 7.1.6, 7.2.4, and 8.1.4.
  • Command: ruby -Ilib -e 'v=ARGV.fetch(0); gem "railties",v; gem "actionpack",v; gem "activerecord",v; load "test/unit/routing_compatibility_test.rb"' 8.1.4 (repeat with each version in an environment containing its gems).
  • The complete upstream suite and older Rails/Ruby matrix were not run. These tests establish routing compatibility only.

This branch has not been deployed

No deployments
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