tsechingho / ckeditor-rails

Integrate CKEditor javascript library with Rails asset pipeline
https://github.com/tsechingho/ckeditor-rails
MIT License
214 stars 133 forks source link

Problem upgrading to rails 6.0.0 #88

Closed tbr00 closed 2 years ago

tbr00 commented 4 years ago

I have an application that has had no problems with ckeditor_rails in in rails 5.2.3. When I try to move to Rails 6.0.0 The application is failing to load with the ckeditor-jquery not being found. The gem is installed (in fact I did a clean install of all the gems), but for some reason Rails.application.config.assets.paths does not include any of the ckeditor directories, where in Rails 5 I see both lib/assets and vendor/assets in the path.

I tried adding these manually which allowed the ckeditor-jquery to load, but then it threw another error failing to load ckeditor/ckeditor, I note that the ckeditor-jquery.js file has three require lines, but there are only two files in the ckeditor directory, and it was not able to load ckeditor/ckeditor. I added an empty ckeditor.js file there and now the application loads fully and works in all respects except I still have no ckeditor.

Any ideas why the Bundler.setup is not putting the ckeditor paths into the Rails.application.config.assets.paths ?

tbr00 commented 4 years ago

Found it. The code at the end of ckeditor-rails.rb takes different actions depending on the Rails version and there is no case in there for version 6:

case ::Rails.version.to_s when /^[45]/ require 'ckeditor-rails/engine' when /^3.[12]/ require 'ckeditor-rails/engine3' when /^3.[0]/ require 'ckeditor-rails/railtie' end if defined? ::Rails

I changed 45 to 456 and voila! The paths are now there, and it loads OK. I have not done extensive testing yet, but it does seem to be working.

douglasfeitosa commented 4 years ago

Can you post the entire solution for this case, please @tbr00 ?

tbr00 commented 4 years ago

The entire solution is to change the one line: when /^[45]/ to: when /^[456]/ At least for my application, it have been working fine in Rails 6 with just this change, which is what is in the pull request I submitted.

andresglownet commented 4 years ago

+1

miks commented 3 years ago

@tsechingho is it possible to release new gem version with this fix for Rails 6?

Mirk32 commented 3 years ago

you can use the following in your Gemfile: gem 'ckeditor_rails', github: 'tsechingho/ckeditor-rails', branch: 'master' works good for me.

miks commented 3 years ago

Why no new version? I can't include github based gem in my gem.

blshkv commented 3 years ago

Ping! please release

davidenglishmusic commented 2 years ago

I'm using ckeditor_rails_6 for the moment. https://rubygems.org/gems/ckeditor_rails_6

tsechingho commented 2 years ago

closed since v4.16.0 released, including ckeditor 4.16.2 and rails 6 support