Problems with ckeditor running on production Rails application with Heroku

别说谁变了你拦得住时间么 提交于 2019-11-30 03:17:43

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.

I just solved this problem following this: https://github.com/galetahub/ckeditor/issues/307#issuecomment-22186377 .

Basically, you add ckeditor asset to the precompile list in application.rb, use the rake task to copy them to the proper location during deployment.

Hope it helps.

I followed the instructions on GitHub

You need to set with true the following variable in the file config/enviroments/production.rb

config.assets.compile = true

and add the following code

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

My environment to this solution was:

gem 'ckeditor', '~> 4.1'

ruby "2.3.0"

rails 5.0.0.1

Adding config.assets.precompile += Ckeditor.assets in your application.rb should do the work.

I had the same problem, here are my files and how I fixed:

application.js

//= require ckeditor/override
//= require ckeditor/init

Gemfile

group :production do
  gem 'rails_12factor'
end

then run bundle to generate Gemfile.lock and commit files to your repo.

production.rb

config.serve_static_assets = true
config.assets.precompile += %w(*.png *.jpg *.jpeg *.gif)
config.assets.compile = false # we don't want compilation fallbacks

Deploy to heroku and verify it.

Hope that helps somehow.

I have been working on application and that works fine in dev env but when i am deploying it to Heroku assets are not loading at all & for that reason i am not able to load TinyMCE or CkEditor js or css.

I found out a work around and compiled assets locally and pushed to Heroku then i got the compiled assests url for CkEditor JS and included it in my view like

<script src="/assets/ckeditor/ckeditor.js"></script>

If you wanna load ckeditor assets from cloud u can use CDN like

<script src="https://cdnjs.cloudflare.com/ajax/libs/ckeditor/4.6.2/ckeditor.js"</script>

Also u need to change few settings in your production.rb file

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

and it starts working on Heroku as well.

For any other issues pls reply.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!