Similar to Integrating CKEditor with Rails 3.1 Asset Pipline
I am trying to integrate ckeditor
with my rails 3.2
application.<
Have similar issue. For me it was fixed by overriding default precompile task (I used Rails 4 and CkEditor 4).
config.assets.precompile += ['ckeditor/*']
//= require ckeditor/init
lib/tasks/precompile_hook
and paste text from this answer Precompile hook I used this guide to add ckeditor to activeadmin in Rails 3.2 with the asset pipeline enabled: https://github.com/gregbell/active_admin/wiki/CKEditor-integration
It worked like a charm.
The only additional thing I did was add this line to my environment:
config.assets.precompile += ['active_admin.css', 'active_admin.js', 'ckeditor/init.js']
rails 3.2 fix:
... blablabla ... //= require ckeditor_fix #- add this line //= require ckeditor/init //= require_tree .
var CKEDITOR_BASEPATH = '/assets/ckeditor/';
I fought with this issue for some hours, but the problem was not with CKEditor, but with my code. I included the ckeditor.js
script inside my partial view which was rendered via AJAX and yes, you guessed it, wasn't working. Once I moved the script including inside the master layout (_Layout), the issue was solved. Of course, this happened to me while working in ASP.NET MVC. For other web frameworks, I have no solution.
This is just an addition. I tried all this and it did not work for me so what i did was to change my ckeditor gem to gem 'ckeditor'
And added this to my application.js
//= require ckeditor/init
Then to precompile my assets, i added this to my production.rb file
config.assets.precompile += Ckeditor.assets
and it all worked like magic
Finally an easy working solution.
Download the CKEditor Zip file, extract the files and place them in the sub directory “javascripts/ckeditor”, add the main JS file to the layout..
javascript_include_tag 'ckeditor/ckeditor.js'
..and write a bit JavaScript code which replaces textareas by CKEditor instances:
$(document).ready(function() {
if ($('textarea').length > 0) {
var data = $('textarea');
$.each(data, function(i) {
CKEDITOR.replace(data[i].id);
});
}
});
Credit Source