To upgrade ruby 2.x to ruby 2.7 and rails 4.x to rails 6.0

Ruby on Rails update

It’s very rare to directly update from ruby 1.8.7 or ruby 2.0 to ruby 2.7 and rails 4 to rails 6.0. As I have recently done many upgrade projects from legacy ruby code to new ruby code. So, I thought to help other developers too.


To do so, I have got the advantage of working from Ruby 2.x to the current version of ruby to I know each and everything from legacy plugin development age to gems and then gems to new replaced gems(if depreciated).


For a small project, I would rather suggest installing a fresh project in the latest ruby and latest rails there. Now, I will replace the app folder of the old code into a new project.

also, I will keep adding configurations carefully as it’s mainly updated.


Regarding other gems, go to their GitHub documentation and check if the community is active (check using the last commit), if yes then you can install with their latest version without setting the gem version. i.e. gem install devise and add gem 'devise' in your Gemfile.


and most important is the GEMS, from the old file, remove all ruby and rails related gems to transfer as new rails is already installed.

In migrations, you will have to add `[6.0]` in migration.

Webpacker update:

Ideally, we should use webpacker with rails 6, but As most clients don’t give time to re-write the javascript code with webpacker. So, It’s better to use normal javascript as in-app/assets folder.


For better projects management, we should follow the process:

  1. Prepare the List of Decreciated gems. Identify all possible new gems which can be used also if required or not.
  2. Prepare the documentation of changes required.
  3. Prepare the timelines accordingly.
  4. Work on ROR update as per your plan.
  5. Always use another branch for any kind of upgrades. and never use the master branch for an upgrade.
  6. Try to write the test cases as well so that you will be sure about the functionality is working properly.
ruby on rails

Feel free to let me know if you face any issue or wish me to work on your ruby on rails update. I will be happy to assist.


Manish S

Leave a Reply

Your email address will not be published. Required fields are marked *