Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Integrating CKEditor with Rails 3.1 Asset Pipline

I'm new to the Asset Pipeline, having just migrated over from Rails 3.0. I'm trying to get CKEditor into the pipeline, but all the gems for it are really unclear about how they work, and have little or no usage instructions.

I would prefer to do this without using a gem, since it seems that all I have to do is drop the source files into the vendor/assets directory and then include them in application.js. I've tried that, however, when I precompile and push to production, it seems that some of the files aren't being found (editor.css, for example), and the editor doesn't show up at all (just blank area).

application.js

//= require jquery
//= require jquery_ujs
//= require ckeditor/ckeditor
//= require_self

That's with the source files in vendor/assets/javascript/ckeditor/, and is pointing to ckeditor.js. I'm just not sure where to go from here. This code works fine in development but does not work in production. I am running rake assets:precompile before adding and committing to git, and then pushing to heroku. Here's a screenshot of the client-side errors that occur

like image 608
bricker Avatar asked Oct 27 '11 10:10

bricker


1 Answers

I got this working (deployed on Heroku), by:

  1. Including the ckeditor code in vendor/assets/javascripts/ckeditor
  2. Adding config.assets.precompile += ['ckeditor/*'] to my production.rb
  3. Setup your ckeditor base path in the application.html.erb var CKEDITOR_BASEPATH = '/assets/ckeditor/'; before the include of the application.js
  4. In application.js, include //= require ckeditor/ckeditor
like image 130
kelsmj Avatar answered Oct 10 '22 10:10

kelsmj