I'm using the ckeditor
ruby gem (v4.2.2) in my Rails app and it works fine in development but not in my production
environment. It doesn't look like a problem with my Asset Pipeline because all other assets load without any issues.
On the page, Google Chrome gives me this error:
Uncaught TypeError: Cannot set property 'dir' of undefined
while Firefox just throws this in the console:
TypeError: c[a] is undefined[Learn More]
What I've tried so far:
- Use
Uglifier.new(mangle: false)
as the JS Compressor in Sprockets - Manually set
CKEDITOR_BASEPATH
The asset files generated by rake asset:precompile
in public/assets/ckeditor
all have a hash at the end like this:
ckeditor-e0b9bfe15298d2b2dd388960b27d35e6a18c89b2390f8986d398c30da5496e4b.js
config-1fb318e1cc0eea7b8c181941c3c1f09d2b96107b2f7ff4891755fbb2201ba53d.js
contents-4540cf2cb7116b32bac2995494c4fc0c55804444f37c02cfa11256bd695e4194.css
# etc
but the JS doesn't seem to be loading them and trying to fix that now.
Code
My Javascript File:
//= require pages-javascript
//= require ckeditor/init
//= require_tree ./ckeditor
//= require_self
Assets Initializer:
# config/initializers/assets.rb
Rails.application.config.assets.version = '1.0'
Rails.application.config.assets.precompile << Proc.new do |filename, full_path|
if filename =~ /\.(css|js|svg|eot|woff|ttf)\z/
app_assets_path = Rails.root.join('app', 'assets').to_s
if full_path.starts_with? app_assets_path
Rails.logger.info "including asset: " + full_path
true
else
Rails.logger.info "excluding asset: " + full_path
false
end
else
false
end
end
Rails.application.config.assets.precompile += %w( ckeditor/* )