Which Ruby on Rails Is Compatible With Which Ruby Version

Which Ruby on Rails is compatible with which Ruby version?

This is an old question, but the fact that rails is tested against a version of ruby is a good indication that it should work on that version of ruby.

Since 9th April 2019, stable branches of Rails use Buildkite for automated testing, and the list of tested ruby versions, by rails branch, is:

Rails 6.1

  • >= 2.5.0

Rails 6.0

  • >= 2.5.0

Rails 5.2

  • >= 2.2.2
  • < 2.7 (see https://github.com/rails/rails/issues/38426)

Rails 5.1

  • >= 2.2.2

Rails 5.0

  • >= 2.2.2

Rails 4.2

  • >= 1.9.3

Rails 4.1

  • >= 1.9.3

Prior to 9th April 2019, stable branches of Rails since 3.0 use travis-ci for automated testing, and the list of tested ruby versions, by rails branch, is:

Rails 3.0

  • 1.8.7
  • 1.9.2
  • 1.9.3

Rails 3.1

  • 1.8.7
  • 1.9.2
  • 1.9.3

Rails 3.2

  • 1.8.7
  • 1.9.2
  • 1.9.3
  • 2.0.0
  • 2.1.8
  • 2.2.6
  • 2.3.3

Rails 4.0

  • 1.9.3
  • 2.0.0
  • 2.1
  • 2.2

Rails 4.1

  • 1.9.3
  • 2.0.0
  • 2.1
  • 2.2.4
  • 2.3.0

Rails 4.2

  • 1.9.3
  • 2.0.0-p648
  • 2.1.10
  • 2.2.10
  • 2.3.8
  • 2.4.5

Rails 5.0

  • 2.2.10
  • 2.3.8
  • 2.4.5

Rails 5.1

  • 2.2.10
  • 2.3.7
  • 2.4.4
  • 2.5.1

Rails 5.2

  • 2.2.10
  • 2.3.7
  • 2.4.4
  • 2.5.1

Rails 6.0

  • 2.5.3
  • 2.6.0

(From https://www.hmallett.co.uk/2018/08/ruby-and-ruby-on-rails-version-compatibility/)

What is the highest Ruby version supported by Rails v4.1.16?

Based on the CI settings for 4-1-stable, I'd say stick with Ruby 2.3. 2.4.0 isn't on that list, as things stand.

That's not to say that 4.1.16 won't run on Ruby 2.4 - I can't really speak to that - but there's always a possibility that you hit subtle issues, depending on the features you use and the gems that you include. Ruby 2.4 has the Fixnum and Bignum unification, as well as unicode changes - which potentially could have an impact.

FWIW, we have a sizeable, battle-tested application on the 4.1.x branch that works just fine on Ruby 2.3.3.

looking for recommended upgrade path for app (ruby 2.3.8 , rails 4.2.11) to the latest stable versions of ruby and rails

The first step is to make sure that your application has enough tests to give you confidence during upgrading the application.

Then you can start the actual upgrade process. There are different ways to do this. I usually suggest updating in smaller steps, instead of huge all in once upgrades, because that makes it much easier to fix issues along the way because you know exactly with Ruby or Ruby on Rails version introduced the issue.

Additionally, each Ruby on Rails version has a range of Ruby versions they are compatible with and you have to update them in matching combinations.

Some people suggest that you should upgrade to the lowest minor and patch version first and then to the latest minor, for example, like 5.0.7.2 -> 5.1.0 -> 5.1.7. But in my experience, it is fine to update directly to the latest version of the next minor version, like 5.0.7.2 -> 5.1.7.

I suggest following this table with Ruby and Ruby on Rails compabilities. This leads to the following upgrade path:

ruby 2.3.8   rails 4.2.11    your current versions
|
ruby 2.3.8 rails 4.2.11.3
|
ruby 2.3.8 rails 5.0.7.2
|
ruby 2.4.10 rails 5.0.7.2
|
ruby 2.4.10 rails 5.1.7
|
ruby 2.5.9 rails 5.1.7
|
ruby 2.5.9 rails 5.2.8
|
ruby 2.6.10 rails 5.2.8
|
ruby 2.6.10 rails 6.0.4.8
|
ruby 2.6.10 rails 6.1.6
|
ruby 2.7.6 rails 6.1.6 minimum combination to still get security fixes
|
ruby 3.0.4 rails 6.1.6
|
ruby 3.0.4 rails 7.0.3 minimum combination to still get bug fixes
|
ruby 3.1.2 rails 7.0.3 latest (summer 2022)

Note that at the time of writing this answer (summer 2022) Ruby 2.7 and Ruby on Rails 6.1.x still get security fixes. Therefore I would suggest that to be the lowest version combination to run on production. Bug fixes are only available for Ruby 3.0 and Ruby on Rails 7.0.x and above.

During each step consult Upgrading Ruby on Rails in the official Rails Guides about what changed in that specific version. After each step, make sure to fix all deprecation warnings that might occur.

Please keep in mind reviewing all your other gems too. I would consider it a good practice to update all gems to the latest versions that are compatible with your current Ruby and Ruby on Rails combination after each step and before making the next upgrade step.

Upgrading Ruby version And Rails Compatibility

RVM gives you a separate gem directory for each and every Ruby version and gemset. This means that gems must be explicitly installed for each revision and gemset. Usually the migration process is as follows:

rvm use ruby-2.4.0 
# or `rvm --default use ruby-2.4.0` if you want to use 2.4.0 from now on
gem install rails -v 5.0.1 # an example, use any version you like
gem install bundler
bundle install # to install all other project gems

See the RVM gemsets documentation page.

When using Rails 3.2.22.2, what is the highest Ruby Version I can use?

Quote from this blog post

Rails 3.2.22 includes all the commits from the 3-2-stable branch. This mean that now Rails 3.2 supports Ruby 2.2.

Since Rails 3.2 doesn't receive bug fixes anymore (only severe security fixes) I would not expect updates to the Rails 3.2 branch that ensure Ruby 2.3 compatibility. Furthermore Rails 3.2 reaches end of life when Rails 5.0 is released (what will be very soon, since 5.0.0.RC1 is already available).



Related Topics



Leave a reply



Submit