JSONAPI-Resources / JSONAPI-Resources/jsonapi-resources

ArgumentError with Rails 8.1

Open
#1,488 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Ruby
Stars
2.3k
Forks
546
PR merge metrics
No merged PRs in 30d

Description

I'm trying to update my app to Rails 8.1.3 and when I run the rails app:update task it fails part way through with this error:

        ...
        skip  bin/setup
       rails  active_storage:update
bin/rails aborted!
ArgumentError: wrong number of arguments (given 4, expected 3) (ArgumentError)

    caller: /Users/jgreen/.asdf/installs/ruby/4.0.3/lib/ruby/gems/4.0.0/gems/jsonapi-resources-0.10.7/lib/jsonapi/routing_ext.rb:134
    |               jsonapi_resource_scope(Resource.new(@resource_type, api_only?, @scope[:shallow], options), @resource_type) do
                                                   ^^^^
    callee: /Users/jgreen/.asdf/installs/ruby/4.0.3/lib/ruby/gems/4.0.0/gems/actionpack-8.1.3/lib/action_dispatch/routing/mapper.rb:1319
    |           def initialize(entities, api_only, shallow, only: nil, except: nil, **options)
                    ^^^^^^^^^^
/Users/jgreen/projects/seshy-api/config/routes.rb:14:in 'block (3 levels) in <compiled>'
/Users/jgreen/projects/seshy-api/config/routes.rb:10:in 'block (2 levels) in <compiled>'
/Users/jgreen/projects/seshy-api/config/routes.rb:9:in 'block in <compiled>'
/Users/jgreen/projects/seshy-api/config/routes.rb:1:in '<compiled>'
/Users/jgreen/projects/seshy-api/config/environment.rb:5:in '<compiled>'
Tasks: TOP => active_storage:update => environment
(See full trace by running task with --trace)

It looks like this is the PR responsible for the change on the rails side. https://github.com/rails/rails/pull/53689

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start at jsonapi/routing_ext.rb line 134 and compare its Resource call with the actionpack routing mapper initializer at Rails 8.1.3 line 1319. Reproduce the failure through config/routes.rb and rails app:update. Done means the task completes without the ArgumentError under Rails 8.1.3.

Written by the indexing model from the issue text.

Assessment

Tech stack
rails, ruby
Domain
api, backend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
50/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.