Skip to content

Get the next-rails (Rails 8.0) bundle booting and green on Ruby 3.4 - #3842

Closed
muhammadsamad99 wants to merge 3 commits into
openSUSE:masterfrom
muhammadsamad99:next-rails-ruby-3-4-csv
Closed

muhammadsamad99 wants to merge 3 commits into
openSUSE:masterfrom
muhammadsamad99:next-rails-ruby-3-4-csv

Conversation

@muhammadsamad99

Copy link
Copy Markdown
Contributor

Checklist

  • I have read the Contribution & Best practices Guide.
  • My branch is up-to-date with the upstream master branch.
  • The tests pass locally with my changes.
  • I have added tests that prove my fix is effective or that my feature works(if appropriate).
  • I have added necessary documentation (if appropriate).

Short description of what this resolves/which issues does this fix?:

  • With BUNDLE_GEMFILE=Gemfile.next on Ruby 3.4.10 the app does not boot, so the Next-rails
    workflow cannot get past db:setup. Three independent causes, one commit each:
    1. cannot load such file -- csv: csv is a bundled (not default) gem since Ruby 3.4 and the
      Gemfile never declared it; the current lockfile only gets it through iso-639.
    2. cannot load such file -- observer: Gemfile.next.lock had drifted from Gemfile.lock
      (factory_bot 6.2.0, missing the connection_pool < 3 pin).
    3. Rails 8.0 raises on resource :contact, except: [:index, ...] because a singular resource
      has no index action (7.2 ignored it).

Changes proposed in this pull request:

  • Declare gem 'csv'. Gemfile.lock keeps csv 3.3.5 and only gains the top-level dependency.
  • Rebuild Gemfile.next.lock from Gemfile.lock with a conservative rails update, and pin the next
    constraint to ~> 8.0.0 so this step lands on Rails 8.0 (8.0.5.1) rather than 8.1.
  • Drop :index from the singular contact resource. rails routes output is identical on 7.2
    before and after.

How it was tested (Docker: ruby:3.4.10 + postgres:16-alpine, same suites as the workflows):

Suite Rails 8.0.5.1 (Gemfile.next) Rails 7.2.3 (Gemfile)
models 783 examples, 0 failures 783 examples, 0 failures
controllers 542 examples, 0 failures 542 examples, 0 failures
ability 93 examples, 0 failures, 2 pending 93 examples, 0 failures, 2 pending
leftovers 95 examples, 0 failures, 1 pending 95 examples, 0 failures, 1 pending
features 106 examples, 0 failures, 3 pending 106 examples, 0 failures, 3 pending

Note: Rails 8.0 security support ends on 2026-11-07, so moving next to 8.1 would be a sensible
follow-up; happy to open that separately if useful.

csv stopped being a default gem in Ruby 3.4 and is now a bundled gem, so it
has to be listed in the Gemfile to be loadable under Bundler. The app requires
it directly (Registration and the admin CSV export views), but the Gemfile
never declared it: the current lockfile only gets csv through iso-639, and the
next-rails lockfile does not get it at all, so the app fails to boot there with
"cannot load such file -- csv".

No version change on the current bundle: Gemfile.lock keeps csv 3.3.5 and only
gains the top-level dependency.
Gemfile.next.lock had drifted from Gemfile.lock since next_rails was
introduced: it still resolved factory_bot 6.2.0, which requires "observer"
(no longer a default gem in Ruby 3.4), and it predates the connection_pool
"< 3" pin. Under Ruby 3.4 the next bundle could not boot.

The lock is rebuilt the way next_rails recommends: copy Gemfile.lock, then
update rails conservatively, so every other gem stays on the version the main
bundle already runs. The next Rails constraint becomes "~> 8.0.0" so this step
stays on Rails 8.0 (now 8.0.5.1) instead of jumping to 8.1; moving to 8.1 can
be a separate step.
A singular resource has no index action. Rails 7.2 ignored it, but Rails 8.0
raises at boot: "Route `resource :contact` - :only and :except must include
only [:show, :create, :update, :destroy, :new, :edit], but also included
[:index]".

No side effects: `rails routes` produces the identical route table on Rails
7.2 before and after this change.
@hennevogel hennevogel mentioned this pull request Oct 13, 2026
@hennevogel

Copy link
Copy Markdown
Member

Not sure how you ended up with 8.0.5 but pinning rails to ~> 8.0.0 will end up on 8.0.2 instead. And it looks like you mixed in some bundle update into it as there are many gem updates included. See #3843 and
https://github.com/fastruby/next_rails how to do this more cleanly...

Thanks for your contribution anyway!

@hennevogel hennevogel closed this Oct 13, 2026
@muhammadsamad99

Copy link
Copy Markdown
Contributor Author

Thanks for taking this over in #3843, and for keeping me as co-author, much appreciated.

You're right about the lock. I copied Gemfile.lock to Gemfile.next.lock and then ran bundle update rails --conservative, which is where 8.0.5.1 and all the unrelated gem bumps came from. Bumping only factory_bot is the cleaner fix, and I'll follow the next_rails workflow you linked next time.

If it helps, I'm happy to do the Rails 8.1 step for the next bundle as a separate PR once #3843 is in, changing only rails and what it requires.

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.

2 participants