JSONAPI-Resources / JSONAPI-Resources/jsonapi-resources

ArgumentError with Rails 8.1

Offen
#1,488 1 Kommentar 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen

Dieses Issue hat noch niemand übernommen.

Vorherrschende Sprache
Ruby
Sterne
2.3k
Forks
546
PR-Merge-Kennzahlen
Keine gemergten PRs in 30 T.

Beschreibung

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

Beitragsleitfaden

Für dieses Repository ist kein Beitragsleitfaden indexiert

Erste Schritte

  1. Lies das ganze Issue und danach den Beitragsleitfaden des Projekts.
  2. Schreib ins Issue, dass du es übernimmst — das erspart doppelte Arbeit.
  3. Forke das Repository und arbeite in einem Branch.
  4. Öffne einen Pull Request, der die Issue-Nummer nennt.

Rechercherichtung

Beginne bei jsonapi/routing_ext.rb Zeile 134 und vergleiche dessen Resource-Aufruf mit dem actionpack-Routing-Mapper-Initializer in Rails 8.1.3, Zeile 1319. Reproduziere den Fehler über config/routes.rb und rails app:update. Erledigt ist die Aufgabe, wenn sie unter Rails 8.1.3 ohne den ArgumentError abgeschlossen wird.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Bewertung

Tech-Stack
rails, ruby
Bereich
api, backend
Issue-Typ
Bug
Schwierigkeit
3/5
Geschätzter Aufwand
1-2 Tage
Aktivitätsstatus
Ruhig
Klarheit
Größtenteils klar
Anfängerfreundlichkeit
50/100

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.