Skip to content

Upgrade Rails to 7.1 #2250

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 16 commits into
base: master
Choose a base branch
from
Draft

Conversation

olleolleolle
Copy link
Collaborator

@olleolleolle olleolleolle commented Aug 6, 2025

This PR upgrades the code base to use Rails 7.1. It is a part of upgrading Rails to latest stable release. Our method is the recommended "one minor at a time".

The PR is now draft, and will be turned into a regular PR when ready for it.

cc @mroderick.

Errors to fix

  • Zeitwerk name expectation - See a2995a2 a297efc
    Zeitwerk::NameError: expected file /home/runner/work/planner/planner/lib/services/event_calendar.rb to define constant Services::EventCalendar, but didn't # ./vendor/bundle/ruby/3.4.0/gems/zeitwerk-2.7.3/lib/zeitwerk/loader/callbacks.rb:31:in 'Zeitwerk::Loader::Callbacks#on_file_autoloaded'
  • Unpermitted parameter: :format. Context: { controller: ChapterController, action: show, request: #<ActionDispatch::Request:0x000000012c45bc30>, params: {"controller" => "chapter", "action" => "show", "id" => "apple-touch-icon", "format" => "png"} } Chapter Load (11.6ms) SELECT "chapters".* FROM "chapters" WHERE "chapters"."active" = $1 AND "chapters"."slug" = $2 LIMIT $3 [["active", true], ["slug", "apple-touch-icon"], ["LIMIT", 1]] ↳ app/controllers/chapter_controller.rb:3:in 'ChapterController#show' Completed 404 Not Found in 593ms (ActiveRecord: 49.0ms | Allocations: 118818)
  • spec/lib/verifier_spec.rb:9 make the Verifier test pass - there is a setting that upgrades the verifier serialization, assess impact of upgrading it
    1) Verifier generates access_token for an id Failure/Error: expect(Verifier.new(id: 1).access_token).to be_eql('BAhpBg==--30d45b871c77098a0ba79cf27dd532650ca75531') expected `"MQ==--a3487195ba15b69d4aa07b7da0234463b82c96b3".eql?("BAhpBg==--30d45b871c77098a0ba79cf27dd532650ca75531")` to be truthy, got false # ./spec/lib/verifier_spec.rb:9:in 'block (2 levels) in <top (required)>' # ./spec/spec_helper.rb:114:in 'block (2 levels) in <top (required)>'

Cleanup

Findings

  • Ticket became Services::Ticket and seems unfinished and unused. We could trim that away, I guess.

This upgrades the gem, and following commits will change configuration, using the "rails app:update" process.
This amended all the configuration files with manually-edited new diffs, getting rid of outdated configuration where known to be outdated.

We wish to keep close to the default configuration, to make updates using these diff scripts easy.
@olleolleolle olleolleolle linked an issue Aug 6, 2025 that may be closed by this pull request
@olleolleolle olleolleolle changed the title Rails71 Upgrade Rails to 7.1 Aug 6, 2025
Zeitwerk::NameError:
  expected file /home/runner/work/planner/planner/lib/services/event_calendar.rb to define constant Services::EventCalendar, but didn't
@olleolleolle olleolleolle marked this pull request as ready for review August 6, 2025 15:54
These files are meant to be used during upgrades, not kept around.
These are meant to be dropped after updating to a version. We are currently setting all of these defaults, using a defaults setting in config/application.rb.
One model needed changing: that callback is run in another order (now: in declared order).

One test needed to not require code on its own.
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.

Upgrade to next Rails: 7.1
2 participants