Ckeditor is a Ruby gem that integrates CKEditor 4.x WYSIWYG text editing into Rails applications (4.x through 7.x), providing form helpers, a file browser, and pluggable storage backends.
What is Ckeditor?
Ckeditor is an open-source Rails engine gem maintained by the galetahub community that wraps the CKEditor 4 JavaScript editor. It takes Rails form builders as input and outputs rich-text editing areas with toolbar configuration, image uploads, and file attachment management. The gem supports Rails 7.x, 6.x, 5.x, and 4.x, and only bundles CKEditor 4 — not CKEditor 5.
Key Features
- Rails integration — Provides
cktext_areaform helpers and mounts as an engine at/ckeditorfor use in any Rails view. - File browser — Includes a ready-to-use files manager page with upload, delete, and listing capabilities for images and attachments.
- HTML5 file uploader — Handles drag-and-drop and multi-file uploads through the built-in filebrowser, backed by six storage options.
- ORM/storage backends — Works with ActiveRecord and Mongoid, and supports active_storage, paperclip, carrierwave, dragonfly, and shrine file storages.
- Authorization hooks — Ships integrations for CanCanCan, Pundit, and Action Policy, with generators for policy files.
- Form builder integrations — Includes hooks for formtastic and simple_form, so forms can use
as: :ckeditorinputs. - Customizable — Toolbars, editor config, and plugins can be overridden via
app/assets/javascripts/ckeditor/config.js.
Who is it for?
- Rails developers building admin panels or CMS-style apps that need rich text editing in forms.
- Teams using CanCanCan, Pundit, or Action Policy who want file browser permissions tied to their existing authorization framework.
- Developers working with formtastic or simple_form who want a drop-in
ckeditorinput type instead of hand-writing textarea JavaScript.
What can you do with it?
- Add rich text editing to any Rails form — Use
form.cktext_area :contentto get a CKEditor instance with configurable language, toolbar, and UI color. - Configure custom toolbars — Override
config.toolbarinconfig.jsto define mini or full toolbars with specific button sets. - Attach images and attachments — Generate models via
rails generate ckeditor:install --orm=active_record --backend=active_storageand let users upload files through the editor. - Secure file browsing — With CanCanCan, grant permissions by adding
can :access, :ckeditorplus read/create/destroy abilities forCkeditor::PictureandCkeditor::AttachmentFile.
How does it work?
Install the gem, mount Ckeditor::Engine in routes, and run the generator to create storage models. Then use the provided form helpers in views. For file uploads, the gem exposes a filebrowser page at /ckeditor with actions that can be secured via the authorization adapters.
Pricing
Ckeditor is open-source software released under the MIT License; no license fee is charged. The CKEditor 4 library itself is distributed under its own license, which the gem bundles.
Alternatives
- Trix — A rich text editor built by Basecamp and the default editor in Rails 6+ Action Text.
- Quill — A modular WYSIWYG editor that can be integrated into Rails via gems like
quilljs-rails.
FAQ
Which Rails versions does Ckeditor support?
The gem supports Rails 7.x, 6.x, 5.x, and 4.x. Earlier Rails versions may need manual autoload path configuration for the generated models.
Does Ckeditor support file uploads?
Yes. The gem includes a file browser and requires you to generate storage models. Supported backends are active_storage, paperclip, carrierwave, and dragonfly for ActiveRecord, and paperclip, carrierwave, and dragonfly for Mongoid. Active Storage only works with ActiveRecord.
Is Ckeditor free?
Yes, the gem is distributed under the MIT License. It does not add a subscription cost, though you still need a CKEditor 4 license for commercial use if required by that library's terms.
How do I integrate Ckeditor with CanCanCan?
In an initializer, call config.authorize_with :cancancan. Then add abilities like can :access, :ckeditor and can [:read, :create, :destroy], Ckeditor::Picture in your Ability class.
Can I use CKEditor 5 with this gem?
No. The README states that this gem currently supports ckeditor 4 only. You would need to use the official CKEditor 5 build or another gem for version 5.





