Is Rails 6.1.x compatible with Ruby 3.1?

Hello,

Is there any official compatibility table between Rails versions and Ruby versions?

In particular, I have a Rails 6.1 app: should I upgrade Ruby to 3.1? Or is Rails 7 required for Ruby 3.1?

Thanks

I don’t think so. Even Rails 7.0 is not compatible, and you need Rails 7.0.1 for that. There was a problem with Rails::Engine being an abstract class and Ruby 3.1 breaking that. I think the 6.1.x branch has not been fixed yet.

EDIT: As mentioned by Jean Boussier below, Rails 6.1 is compatible. Also, Rails 7.0.1 is out, all stable and supported versions of Rails should now be compatible.

2 Likes

using ruby 3.0 for rails 7 is good

Crushes my dreams of updating my apps to 3.1 anytime soon but this is good to know.

That problem was specific to Rails 7, 6.1 shouldn’t have that problem and shouldn’t need fixing for that.

I just gave a quick glance at the 6-1-stable branch, and I don’t think there’s really any Ruby 3.1 specific problems.

You might need to do some Gemfile workaround for some stuff that were moved from the stdlib to bundled gems but as far as I know that’s about it.

Anyway, best way to know is to upgrade ruby on a branch and run your CI (if your Ci infra supports it of course)

Rails 7.0.1 is compatible with Ruby 3.1. Rails 7.0 is not.

2 Likes

Latest Rails releases are compatible with Ruby 3.1. But not all common gems are compatible with Ruby 3.1 yet.

I have seen various troubles with Nokogiri (with binary gem), mail gem (really common dependency), RubyGems and Bundler itself emitting warnings… Even almost all those problems could by bandaided somehow currently, I’m waiting for Ruby 3.1.1 planned for January. I expect most common problems to be fixed at that time. :pray:

I am happy to announce that Rails 7.0.1 has been released. The focus of this release is bring support to Ruby 3.1,

FYI, the following Gist entry summarizes Ruby 3.1 on Rails.

1 Like

Is Rails 6 compatible with Ruby 3.1 yet?

Is someone using Ruby 3.1 with Rails 6.1 ? Did you experience any problems?