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?
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.