ruby -- 进阶学习(十三)解说ckeditor在production环境下如何完整显示
2013-09-07 00:13
417 查看
将ROR项目从development环境改为production环境时,运行rake assets:precompile后,
ckeditor的界面就无法完整显示?! @_@??
出现 ActionController::RoutingError (No route matches [GET] "/assets/ckeditor/config.js")
solution :creating a rake task that couples with "assets:precompile" to create "non-digested" versions of the ckeditor asset files after pushing to production,and made a /lib/tasks/ckeditor.rake file with the following task.
就是说在 /lib/tasks目录下创建个新的文件ckeditor.rake,在该文件中添加下面代码:
然后在 /config/application.rb中添加下面代码:
接着在 /app/assets/javascripts/application.js中添加:
在 /config/route.rb 中,
重新运行 rake assets:precompile
这样ckeditor的界面就能完整显示啦!!
@_@!! over~~
附:参考链接:https://github.com/galetahub/ckeditor/issues/307
ckeditor的界面就无法完整显示?! @_@??
出现 ActionController::RoutingError (No route matches [GET] "/assets/ckeditor/config.js")
solution :creating a rake task that couples with "assets:precompile" to create "non-digested" versions of the ckeditor asset files after pushing to production,and made a /lib/tasks/ckeditor.rake file with the following task.
就是说在 /lib/tasks目录下创建个新的文件ckeditor.rake,在该文件中添加下面代码:
# lib/tasks/ckeditor.rake require 'fileutils' desc "Create nondigest versions of all ckeditor digest assets" task "assets:precompile" do fingerprint = /\-[0-9a-f]{32}\./ for file in Dir["public/assets/ckeditor/**/*"] next unless file =~ fingerprint nondigest = file.sub fingerprint, '.' FileUtils.cp file, nondigest, verbose: true end end
然后在 /config/application.rb中添加下面代码:
config.autoload_paths += %W(#{config.root}/app/models/ckeditor) config.assets.precompile += Ckeditor.assets config.assets.precompile += %w(ckeditor/*)
接着在 /app/assets/javascripts/application.js中添加:
//= require ckeditor/ckeditor
在 /config/route.rb 中,
mount Ckeditor::Engine => '/ckeditor'
重新运行 rake assets:precompile
这样ckeditor的界面就能完整显示啦!!
@_@!! over~~
附:参考链接:https://github.com/galetahub/ckeditor/issues/307
相关文章推荐
- ruby -- 进阶学习(十一)配置解决production环境下无法加载css或js
- ruby -- 进阶学习(十六)ckeditor去除“浏览服务器”按钮
- ruby -- 进阶学习(五)使用Ckeditor插件上传中文图片
- 如何在Mac OS X上安装 Ruby运行环境
- 如何快速正确的安装 Ruby, Rails 运行环境
- 如何在Mac OS X上安装 Ruby运行环境
- ruby -- 进阶学习(十五)friendly_id配置
- CocoaPods介绍。如何安装Ruby环境,如何下载和安装CocoaPods?
- 如何快速正确的安装 Ruby, Rails 运行环境
- leeboy的linux学习十三环境变量实例
- 如何在非英文环境中正确显示数字
- 如何快速正确的安装 Ruby, Rails 运行环境
- Mac os 如何快速正确的安装 Ruby, Rails 运行环境
- OpenCV学习一 环境搭建和显示第一张图片
- netbeans如何去掉竖着的红线以及在左上角标题栏目显示完整文件路径
- 如何完整的显示数据库中用户用TextBox插入的数据,包括回车,换行。。。。。
- 【指导]如何编译完整建立开发环境和编译Android 4.0.1 on Ubuntu 11.04 (64 bit)
- 含有GROUP BY子句的查询中如何显示COUNT()为0的结果( SELECT语句完整的执行顺序)
- 学习:如何在已有MOSS的环境下重装IIS(转)
- CEGUI学习笔记三-- 如何显示中文