ruby-on-rails - 生产模式的 Ckeditor gem 问题

标签 ruby-on-rails ruby ckeditor

我正在使用 CKEditor gem .我对 application.jsroutes.rb 的配置如下:

# application.js
//= require ckeditor/init

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

gem 在开发模式下工作正常,但是当转到生产模式时,当浏览器请求 ckeditor 文件夹中的 js 和 css 文件时出现错误 404:

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) 

请帮助我修复我的 ckeditor 路由配置。提前谢谢你。

最佳答案

您需要明确指示 Rails 在生产环境中预编译您的 CKEditor Assets :

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

然后,在您的生产环境中,强制进行预编译:

rake assets:precompile:all

关于ruby-on-rails - 生产模式的 Ckeditor gem 问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17636564/

相关文章:

Ruby 2.2.0 无法在 Ubuntu 14.04.1 LTS 上构建

browserify 中的 ckeditor : home dir error

ruby-on-rails - Elasticsearch 的多方面过滤器

ruby-on-rails - rails 4 : assets on Heroku

ruby-on-rails - 什么会导致迁移除了保留正确的版本外什么都不做?

ruby - 使用 Nokogiri 进行模式验证

ruby-on-rails - Rails 4 嵌套形式 "Unpermitted Parameters"在其他任何地方都没有回答

javascript - 通过 JavaScript 从 CKEditor 的样式框中分配一些样式

ckeditor - 在前端使用 TYPO3 ckeditor

ruby-on-rails - Rails "acts-as-taggable-on": how to add tag *objects* to taggables, 不按名称