ActionText in Rails 6

Wordpress blog post editor is crappy. I cancelled Wordpress business plan and got a full refund of $255. It only costs $5 per month on Linode. I decided to use ActionText in Rails 6 to host my blog. In that blog I share my lessons learned in how to build a SaaS business from scratch.

Install Rails 6 beta1

Create a Gemfile in a project folder called blog:

source ''

gem 'rails', git: ''

Run bundle. Create a new Rails 6 project in the current directory.

bundle exec rails new . --dev --force

Check the basic Rails 6 app:

bundle exec rails server

You can see the home page at localhost:3000. Uncomment:

gem 'image_processing', '~> 1.2'

in Gemfile. Run bundle. Install action_text.

bundle exec rails action_text:install

Run the migration:

rails db:migrate

Create article resource:

rails g scaffold article title body:text

Run migration. Add the declaration for rich text in the article model.

class Article < ApplicationRecord
  has_rich_text :body

Change the form partial:

<div class="field">
  <%= form.label :body %>
  <%= form.rich_text_area :body %>

to use rich text area instead of text area for body field of the article model. That's it. You can now use the rich text editor.

Related Articles