06/08/2011
rails-ckeditor
postet by Matthias Frick in Ruby on Rails / 0 Comments
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://github.com/galetahub/rails-ckeditor.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.

