2

ckeditor が heroku で機能しなくなった理由がわかりません。私のローカルマシンでは問題なく動作します。

更新: アセットが heroku でホストされている場合、asset_sync gem がなくても機能しますが、それでは機能しません。

エラー: Uncaught SyntaxError: Unexpected token < in config.js:1 ckeditor cannot find config.js, < は 404 not found ページの開始タグです リソースの読み込みに失敗しました: サーバーは 406 のステータスで応答しました (受け入れられません)

私が得ることができる助けに感謝します。

Ckeditor gem、Heroku、Rails 4、asset_sync

アプリケーション.js

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

gemfile - バージョン 4.0.7

gem "ckeditor" 

アプリケーション.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"
4

3 に答える 3

2

アセットのバージョンが更新されたときに機能します

于 2013-12-31T04:11:08.187 に答える
1

https://github.com/galetahub/ckeditor#include-customized-ckeditor_basepath-settingに基づいて、(ckeditor/init の前に) ckeditor/basepath.js.erb を含めることで、Heroku で asset_sync を使用して CKEditor アセットを読み込むことを修正しました。

<%
  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);
于 2014-10-31T11:45:31.147 に答える
0

これは、システムで ASSET バージョンが更新されたときに機能します。

于 2014-01-05T14:37:46.870 に答える