如何将CKEditor与Heroku集成?

这有点棘手,因为Heroku在他们的Dyno Grid中使用只读文件系统。

这意味着当尝试远程安装ckeditor时,我收到一个错误:

heroku rake db:migrate rake aborted! Read-only file system - /disk1/home/slugs/362142_8858805_b85c-f2f3955d-f087-4bc4-8b1b-b6e898403a10/mnt/public/javascripts/ckcustom.js 

ckcustom.js是一个配置文件,用于管理ckeditor的元设置。 我想知道是否有其他人有这些麻烦,他们做了什么来绕过他们?

有没有理由说你不是只是将它提交给git并将其与其他来源一起推送到heroku? 我从来没有用heroku配置CKeditor,但是应该使用AFAIK。

发生此错误的原因是因为Heroku在我的生产环境中运行。 因为CKEditor是在新环境中设置的,所以它会尝试编写一堆文件。 因为Heroku是一个只读文件系统,所以它会中止此过程。 为了绕过这个错误:

在本地计算机上,执行以下操作:

 rails s -e production 

查看您的网站,CKeditor将为生产环境编写这些文件。

 git add . git commit -m "added files to Production for Heroku" git push heroku master 

它现在应该!

一个便宜的方法是转到easy_ckeditor / init.rb并注释掉check_and_install:

 #require 'ckeditor_file_utils' #CkeditorFileUtils.check_and_install 

对我有用的解决方案如下:

确保

 bundle update ckeditor 

然后,将这些行添加到config/application.rb

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

这在其他堆栈溢出线程中得到了回答: ckeditor在使用Heroku的生产Rails应用程序上运行时出现问题