Manual upload: Rails 6 — Active Storage, TinyMCE 5 and AWS S3
Based on Mirko Akov blog post about Manual uploads using Active Storage, I’ve desided to share example of manual image upload to AWS S3 using Rails 6 Active Storage and TinyMCE 5 editor.
Instructions for Active Storage setup:
You don’t have to use has_one_attached/has_many_attached on tinymce editors content.
Instructions for TinyMCE 5 setup:
Gems I used:
gem “aws-sdk-s3”, require: false
gem ‘tinymce-rails’
Additional Uploader controller — gets image, uploads and returns url back to editor:
In tinymce.yml file add: images_upload_url: ‘/uploader/image’
In config/routes.rb add:
post ‘uploader/image’, to: ‘uploader#image’
In my _form.html.erb
That is it!
It took me one week to connect all dots, I hope it saves your time! 🦄