Rails 8.1: jsonapi_resources DSL fails to generate relationship routes due to Resource#initialize signature change
Nobody has claimed this yet.
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 42/100
Research direction
Start in lib/action_dispatch/routing/mapper/resources.rb and trace the jsonapi_resources DSL with Rails 8.1.1, focusing on how options reach Resource.new and whether jsonapi_relationships runs. Reproduce the deal_individuals declaration and verify that the expected relationship routes are generated instead of raising RoutingError.
Written by the indexing model from the issue text.
Description
After upgrading to Rails 8.1.1, JSONAPI‑Resources fails to generate relationship routes.
Requests like:
raise:
RoutingError (No route matches ...)
even though the resource is declared with:
jsonapi_resources :deal_individuals
Cause
Rails 8.1 changed ActionDispatch::Routing::Mapper::Resources::Resource#initialize to require keyword args (only:, except:, **options). The JSONAPI‑Resources DSL still passes a positional options hash, so jsonapi_relationships never runs and relationship routes are missing.
Patch Location
lib/action_dispatch/routing/mapper/resources.rb (or an initializer monkey‑patch if overriding locally).
Suggested Fix
Splat options:
resources @resource_type, **options
Call Resource.new with keyword args:
Resource.new(@resource_type, api_only?, @scope[:shallow], only: options[:only], except: options[:except], **options)
Use configured route formatter for path:
options[:path] = JSONAPI.configuration.route_formatter.format(@resource_type)
- Dominant language
- Ruby
- Stars
- 2.3k
- Forks
- 546
- PR merge metrics
- No merged PRs in 30d
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from JSONAPI-Resources/jsonapi-resources
-
Difficulty 1/5 Under an hour Newbie friendliness 85/100
-
Difficulty 3/5 1-2 days Newbie friendliness 50/100
JSONAPI-Resources/jsonapi-resources#1488 · 1 comment ·
-
Difficulty 4/5 3-5 days Newbie friendliness 30/100
JSONAPI-Resources/jsonapi-resources#1477 · 3 comments · 1 reaction ·
-
Difficulty 3/5 1-2 days Newbie friendliness 45/100
-
Difficulty 4/5 3-5 days Newbie friendliness 45/100
JSONAPI-Resources/jsonapi-resources#1473 · 1 comment ·
All issues in JSONAPI-Resources/jsonapi-resources
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
simp/pupmod-simp-simp#395 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 80/100
simp/pupmod-simp-rsyslog#219 ·
-
Difficulty 1/5 Under an hour Newbie friendliness 90/100
simp/pupmod-simp-pupmod#256 ·
-
Difficulty 1/5 Under an hour Newbie friendliness 90/100
simp/pupmod-simp-sudo#150 ·
-
Difficulty 1/5 Under an hour Newbie friendliness 90/100