ckeditor运行在生产Rails应用程序与Heroku的问题 [英] Problems with ckeditor running on production Rails application with Heroku
问题描述
我在 Rails 4 应用程式中使用 ckeditor 宝石。
一切都在本地和我的staging heroku环境下工作,但是我在推送生产环境时遇到这个错误:
GET http://myapp.herokuapp.com/assets/ckeditor/contents.css 404(找不到)
GET http://myapp.herokuapp.com/assets/ckeditor/skins/moono/icons.png 404(找不到)
编辑器显示得很好,
我按照README( https://github.com/galetahub/ckeditor )
1)Gem安装,生成
2) config.autoload_paths + =%W(#{config.root} / app / models / ckeditor) code> in application.js
3) mount Ckeditor :: Engine => / ckeditor
in routes.rb(我不明白为什么)
4)在application.js
// = require ckeditor / override
// = require ckeditor / init
这是做什么,为什么需要覆盖? (这些文件位于哪些位置,因为 / app / assets
中没有 / lib / assets
/ vendor / assets
)
Heroku是只读的,因此我不能运行rake任务在教程中解释。
我想这就是为什么我在生产模式下得到错误。
任何人都面临这个问题吗?
我遇到了所有stackoverflow问题,但northing解决了我的问题到目前为止。
UPDATE: b
我发现使它工作的唯一方法是现场编译: config.assets.compile = true
但我会
目前解决这个问题的解决方案已更改。
不需要添加ckeditor / override.js
gem。
包更新ckeditor
2将此行添加到您的文件config / application.rb
config.assets.precompile + = Ckeditor.assets
config.assets.precompile + =%w(ckeditor / *)
config.autoload_paths + =%W(#{config.root} / app / models / ckeditor)
它适用于我,希望也会为你工作。
I'm using the ckeditor gem in my Rails 4 application. Everything works great locally and on my staging heroku environment, but I get this errors when pushing on the production environment :
GET http://myapp.herokuapp.com/assets/ckeditor/contents.css 404 (Not Found)
GET http://myapp.herokuapp.com/assets/ckeditor/skins/moono/icons.png 404 (Not Found)
The editor shows up well, but all icons are missing.
I followed the README (https://github.com/galetahub/ckeditor), but I'm probably missing something.
Here are my steps:
1) Gem installation, generate etc ...
2) config.autoload_paths += %W(#{config.root}/app/models/ckeditor)
in application.js
3) mount Ckeditor::Engine => "/ckeditor"
in routes.rb (I don't understand why)
4) In application.js
//= require ckeditor/override
//= require ckeditor/init
What is this doing exactly, why is override needed ? (Where are located these files, because there are not in /app/assets
, neither in /lib/assets
neither in /vendor/assets
)
Heroku is read only oriented, therefore I can't run the rake task as explained in the tutorial. And I think this is why I get the errors in production mode.
Is anyone faced this problem ? I ran through all stackoverflow questions, but northing resolved my problem so far.
UPDATE :
The only way I found out to make it works is the live compilation : config.assets.compile = true
But I would prefer not to use this in production, and I don't understand why it does work.
Currently the solution for this problem has been changed.
There is no need to include "ckeditor/override.js"
1 Update your gem.
bundle update ckeditor
2 Add this line to your file config/application.rb
config.assets.precompile += Ckeditor.assets
config.assets.precompile += %w( ckeditor/* )
config.autoload_paths += %W(#{config.root}/app/models/ckeditor)
It works for me hope will work for you too.
这篇关于ckeditor运行在生产Rails应用程序与Heroku的问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!