Where Can i know for which version of ruby is officially tested for a particular version of rails

I have a legacy application of ruby on rails 4.2 and ruby version 2.6. As ruby 2.6 upgrade has reached its end of life, I need to upgrade to ruby 3.1. when I checked rails | RubyGems.org | your community gem host its says only the lower limit. ie ruby version greater 1.9.3 is enough. It did not mention if its supported officially with ruby 3.

but when I tried to rails 4.2 application on ruby 3. It failed . It failed even for ruby 2.7.

So How can i know should I update my rails version or not?

I always refer to this page: Ruby & Rails Compatibility Table - FastRuby.io | Rails Upgrade Service

As ruby 2.6 upgrade has reached its end of life, I need to upgrade to ruby 3.1

Note that Rails 4.2 has reached end of life too.

It did not mention if its supported officially with ruby 3.

For older Rails versions, you can look into .travis.yml file to find out what Ruby versions it was tested with.

Rails 4.2 was released on 2014-12-20, Ruby 3.0 on 2020-12-25. So when Rails 4.2 was released, nobody was aware of Ruby 3.0 - developers could only test against Ruby versions at that time. Of course somebody could take the effort and test compatibility of newer Ruby versions against old Rails versions, but I guess it’s not that interesting.

My personal advice would be: If you have to maintain an old Rails app, stick to the Ruby version you know it’s running OK with. If you want to upgrade because of security concerns, you should upgrade the Ruby version plus the Rails version plus all the other versions from the Gemfile.

1 Like

Rails 4.2 was released long before Ruby 2.7 and Ruby 3.0. These versions introduced breaking changes and deprecations. For ex, Ruby 2.7 and 3.0 introduced changes to how keyword arguments are handled, which Rails 4.2 doesn’t account for. Also, many of the gems you’re using might not support Ruby 2.7 or 3.0 when paired with Rails 4.2.

You can also try using RailsUp. This is a free gems compatibility checker tool. You can analyze your app’s gemfile and identify outdated or incompatible gems. You can also get the complexity score and an estimate of the time required for the upgrade process.

If you install The Brick then a Rails 4.2 app will work with Ruby 2.7.

And once there then you can upgrade your Rails versions all the way to 7.0.

And once there you can upgrade your Ruby version to the latest, and finally upgrade all the way to Rails 8.0.

You’ve really made the Swiss Army knife here, haven’t you!

Walter

It’s pretty much a “Rails +” kind of option for either upgrading existing apps or creating new ones. (Or just quickly spinning up an admin panel to be used for development / testing.)