VinhBS VinhBS - 11 months ago 58
Ruby Question

Ckeditor gem issue with production mode

I'm using the CKEditor gem. My config for

are like the followings:

# application.js
//= require ckeditor/init

# routes.rb
mount Ckeditor::Engine => '/ckeditor'

The gem works fine in development mode, but when moving to the production mode, I got the error 404 when browsers request the js and css files in ckeditor folder:

GET http://mydomain/assets/ckeditor/config.js?t=D2LI 404 (Not Found)
GET http://mydomain/assets/ckeditor/skins/moono/editor.css?t=D2LI 404 (Not Found)
GET http://mydomain/assets/ckeditor/lang/vi.js?t=D2LI 404 (Not Found)
GET http://mydomain/assets/ckeditor/styles.js?t=D2LI 404 (Not Found)

Please help me to fix my ckeditor route config. Thank you in advance.


You'll need to explicitly direct Rails to precompile your CKEditor assets in production:

# config/application.rb
config.assets.precompile += Ckeditor.assets

Then, within your production environment, force a precompilation:

rake assets:precompile:all