Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Which Ruby on Rails is compatible with which Ruby version?

I have an old 2.1.1 Ruby on Rails application, with the system upgraded to use Ruby 1.8.7. It originally used 1.8.5 or so.

I want to upgrade it to Ruby 1.9.x for performance reasons, and possibly to a newer Ruby on Rails as well.

I cannot find any easy chart of compatibility between different Ruby versions and Ruby on Rails versions.

Will 2.1.1 work with Ruby 1.9.x? If not, how far do I need to upgrade it first, and what kind of issues am I likely to encounter? My application does complicated things to database layer, but the rest is fairly straightforward.

like image 952
taw Avatar asked Jan 31 '12 21:01

taw


People also ask

Is rails compatible with ruby 3?

Rails 5.2 doesn't work with Ruby 3.0 #40938.

Which Ruby version should I use?

Use the newest Ruby3, which is old. If you're just starting with Ruby, install with Homebrew and work on a project with Ruby 3.0. When you start building another project, it may be time to install a version manager so you can juggle projects with different Ruby versions.

Is ruby 2.7 backwards compatible?

They set up the application to be dual-bootable in both Ruby 2.6 and Ruby 2.7 by using an environment variable, she said. "This made it easy for us to make backwards compatible changes, merge those to the main branch, and avoid maintaining a long running branch for our upgrade," she said.


2 Answers

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/)

like image 118
hmallett Avatar answered Oct 07 '22 10:10

hmallett


For versions < 3.2: http://www.devalot.com/articles/2012/03/ror-compatibility

For versions >= 4.0:

  • Rails 4 recommends 2.0 (src: Rails blog)
  • Rails 4.1/4.2 recommends 2.1 (src: Rails former download page)
  • Rails 4.2.1 recommends 2.2 (src: Rails former download page)
  • Rails 5.0 requires 2.2.2+ (Rails blog)

Rails 3.2

  • 3.2.13 supports Ruby 2.0 (Blog post)
  • 3.2.22 supports Ruby 2.2 (Blog post)

I tried stepping out of those recommendations (mainly running Rails 3.0 on Ruby 2.0 and 2.1), I ran in multiple weird issues.

like image 32
gamov Avatar answered Oct 07 '22 10:10

gamov