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.
For better projects management, we should follow the process:
- Prepare the List of Decreciated gems. Identify all possible new gems which can be used also if required or not.
- Prepare the documentation of changes required.
- Prepare the timelines accordingly.
- Work on ROR update as per your plan.
- Always use another branch for any kind of upgrades. and never use the master branch for an upgrade.
- Try to write the test cases as well so that you will be sure about the functionality is working properly.
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.