Today I checked out a nice gem called "rails-ckeditor". This gem contains the rich editor ckeditor.

You'll find the gem here: Github rails-ckeditor

Check it out once:

1. Add the gem to your Gemfile:

gem 'ckeditor', :git => 'git://', :branch => 'rails3'


2. Generate the basics:

rails generate ckeditor:base


After you generated the basics and die js-files you can configure the editor in "config/initializers/ckeditor.rb".

3. You can take as backend for uploaded images and files for example paperclip, just generate the necessary migrations for that:

rails generate ckeditor:migration


4. Do not forget to migrate your database:

rake db:migrate


5. You have to add the new models to the autoload path in your application.rb:

  config.autoload_paths += %W( #{config.root}/app/models/ckeditor )


6. Include the js-files in your layout:

 <%= javascript_include_tag :ckeditor %>


7. Then instead of the normal textarea helper from Rails use this one:

<%= ckeditor_textarea("object", "field", :width => '100%', :height => '200px') %>


Check out the github repository from this gem for more information

In my opinion it's worth a try to check this editor out. Further I recommend to include the rails3-branch directly in the Gemfile. I had problems with other versions.

Matthias Frick
Ruby on Rails
0 Kommentare

Über den Autor

Matthias Frick
Matthias Frick, MSc.

Er ist ein langjähriger Ruby-on-Rails Entwickler und leitet das Unternehmen Frick-Web.

0 Kommentare zu "rails-ckeditor"

Kommentar verfassen