Rails 7, TinyMCE 6, and uploading with ActiveStorage

Phil Smy
4 min readMay 14, 2023

Despite its age, the very maintained open-source rich text editor TinyMCE works very well with Rails 7. Here’s a quick summary of what you need to know, including image uploading.

This article is not rocket science but comes about mostly because of the frustration I had in finding all the instructions in one place.

1. Install TinyMCE into your Rails app

//Gemfile
gem 'tinymce-rails'

As of this writing in May 2023 that gets me the version 6.4.1

2. Edit the tinymce.yml to your liking

Switches and options are always changing. Right now mine looks like this, but refer to the Documentation for what you can and can’t do

menubar: "insert view format table tools"
toolbar:
- bold italic | link | undo redo | forecolor backcolor | bullist numlist outdent indent | table | uploadimage | code
plugins:
- table
- fullscreen
- image
- code
- searchreplace
- wordcount
- visualblocks
- visualchars
- link
- charmap
- directionality
- nonbreaking
- media
- advlist
- autolink
- lists
images_upload_url: '/uploader/image'

NOTE: for image uploading to work you need that last line!

--

--

Phil Smy
Phil Smy

Written by Phil Smy

Thinker, musician, writer and chief cook and code washer at ZonMaster.com. He’s also a published fiction author.

Responses (2)