2

Can't seem to figure out why ckeditor no longer works on heroku. It works fine on my local machine.

UPDATE: works without the asset_sync gem when assets are hosted on heroku - but does not work with it.

Errors:Uncaught SyntaxError: Unexpected token < in config.js:1 ckeditor cannot find config.js, the < is an opening tag of the 404 not found page Failed to load resource: the server responded with a status of 406 (Not Acceptable)

Appreciate any help I can get.

Ckeditor gem, Heroku, Rails 4, asset_sync

application.js

//= require ckeditor/init
//= require ckeditor/config

gemfile - version 4.0.7

gem "ckeditor" 

appplication.rb

config.autoload_paths += %W(#{config.root}/app/models/ckeditor)
config.assets.precompile += Ckeditor.assets
config.assets.precompile += %w(ckeditor/*)

production.rb

config.assets.compile = true
config.action_controller.asset_host = "//#{ENV['FOG_DIRECTORY']}.s3.amazonaws.com"
Bhavik Ambani
  • 6,557
  • 14
  • 55
  • 86
user2515011
  • 127
  • 1
  • 12
  • read this https://github.com/galetahub/ckeditor/issues/333 hope it will help you – hawk Dec 25 '13 at 09:36
  • It works if assets are hosted on Heroku - but I'm using the asset_sync gem and I can't get that to work...... removed asset_sync and tested - and it works - so now need to figure out how to put that back in -Thanks! – user2515011 Dec 25 '13 at 11:46

3 Answers3

2

Works when the asset version is updated

user2515011
  • 127
  • 1
  • 12
1

Based on https://github.com/galetahub/ckeditor#include-customized-ckeditor_basepath-setting I have fixed loading CKEditor assets with asset_sync on Heroku by including (before ckeditor/init) a ckeditor/basepath.js.erb:

<%
  base_path = File.join Rails.application.config.action_controller.asset_host || '',
                    Rails.application.config.assets.prefix,
                   '/ckeditor/'
%>

(function() {
  if (typeof window['CKEDITOR_BASEPATH'] === "undefined" || window['CKEDITOR_BASEPATH'] === null) {
    window['CKEDITOR_BASEPATH'] = '<%= base_path %>';
  }
}).call(this);
tomaszbak
  • 8,247
  • 4
  • 44
  • 37
0

This will work when the ASSET Version is updated in the system.

Bhavik Ambani
  • 6,557
  • 14
  • 55
  • 86