在线时间:8:00-16:00
迪恩网络APP
随时随地掌握行业动态
扫描二维码
关注迪恩网络微信公众号
将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,在该文件中添加下面代码: # 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 |
2023-10-27
2022-08-15
2022-08-17
2022-09-23
2022-08-13
请发表评论