How to upgrade Ruby versions for your Ruby on Rails app
Continuing our technical founder training series, in this short post we’ll walk through upgrading Ruby versions for our Rails app.
Installing the latest Ruby version
As of this writing, Ruby 3.0.0 is the latest version. Be sure, however, to check here to make sure you are grabbing the latest stable version. Open your terminal and:
- rvm install 3.0.0
This takes a few minutes. Once done, be sure to “cd ~/apps/quotesapp” and then type in:
- rvm use 3.0.0
Updating your Gemfile
Open your Gemfile in your app root folder and on line 4 change the Ruby version to 3.0.0. This is a good time to also check if another Rails version has been released, and indeed one has in our case, so on line 7 we’ll go ahead and bump the version to 6.1.1.
Obviously if you are reading this in the future then be sure to use the latest versions of each.
Installing all the new gems
From here, all you need to do is:
- gem install bundler
- bundle update
While you are at it, it’s also a good idea at this point to:
- yarn upgrade
This will ensure you are all up to date.
Now, test your app.
In the next post in this series we will talk about writing automated tests, but for now, fire up your rails server (“rails s”) and then open two windows side by side and test all three forms (Rails, React, and Turbo) in both windows to ensure everything is working. Be sure to test deleting quotes from all six lists (three in each window) to check that the quote is correctly removed from all six lists no matter which list you click on.
Finally, commit and push your code to Github
Per usual check your changed files, which should look like this commit, and then:
- git commit -a -m "upgrade to Ruby 3.0.0, Rails 6.1.1, and upgrade js packages"
- git push
And that’s it!
As always, feel free to email me at email@example.com if you run into any problems.