Upgrading to Rails 6 and using Action Text

I recently updated an app from Rails 5.2 to Rails 6 and also integrated Action Text. This post looks into how I did the same.

Rails and Ruby Versions

First, check what version of Rails you are currently using before you update to the latest version of Rails. You can do this via the console with the 'rails -v' and the 'ruby -v' commands.
Image

On my personal website I am currently on the older version of Rails - Rails 5.2.x
Rails 6 states that it requires either Ruby 2.5 or higher - so make sure to also check that your Ruby version is upto date.
I am currently using Ruby 2.5, but updated it to the latest Ruby version using Homebrew and rbenv.

Use the following commands to do the same:
brew update && brew upgrade 
ruby-build rbenv install 2.6.0

Updating Gem files
Add this to your gemfile:
gem 'rails', github: 'rails/rails'
You should now be good to go. To install the new dependencies, run:
bundle update rails

Webpacker
Webpacker is the default Javascript compiler for Rails 6, but is not automatically included if you are upgrading from a previous version of Rails. So, to include webpacker in your Rails app, do the following:
gem "webpacker"
bundle install
bin/rails webpacker:install

Action Text and Action Mailbox
Both Action Text (bringing rich text content and editing to Rails) and Action Mailbox (allowing you to route incoming mails to controller-type mailboxes) have been added by default, and to include them run the following command:
rails app:update
In order to install Action Text, you also need to run this command
rails action_text:install

You have now updated the app to Rails 6 and everything is almost good to go. Before you push to production make sure to 
  1. And missing gems
  2. Run your tests and fix the failing ones


Weekly Newsletter

Subscribe to get my weekly newsletter and latest articles on startups, marketing and growth.

I’m Arjun Rajkumar, and I'll help you build a product that your customers will love.

Here is a sample of some of my past work.