Which Ruby on Rails is compatible with which Ruby version?
Solution 1:
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/)
Solution 2:
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.