File upload RAILS 5:浏览服务器CKEditor错误';未定义的方法'path'';上传图片后

File upload RAILS 5:浏览服务器CKEditor错误';未定义的方法'path'';上传图片后,file-upload,ckeditor,image-uploading,ruby-on-rails-5,File Upload,Ckeditor,Image Uploading,Ruby On Rails 5,我只是在ckeditor中上传图像,包括carrierwave和cloudinary 我试过一次,效果很好,我可以在笔记本电脑上浏览图像,然后通过ckeditor中的图像上传器上传到cloudinary。但当我尝试编辑或创建新文章并尝试上传图片时,图像上传器不再工作。我不知道为什么,我没有编辑任何成功后,使图像上传。有人能帮我吗?反正是thx 像这样出现的错误 这是我的模型/ckeditor/asset.rb class Ckeditor::Asset < ActiveRecord::B

我只是在ckeditor中上传图像,包括carrierwave和cloudinary 我试过一次,效果很好,我可以在笔记本电脑上浏览图像,然后通过ckeditor中的图像上传器上传到cloudinary。但当我尝试编辑或创建新文章并尝试上传图片时,图像上传器不再工作。我不知道为什么,我没有编辑任何成功后,使图像上传。有人能帮我吗?反正是thx

像这样出现的错误

这是我的模型/ckeditor/asset.rb

class Ckeditor::Asset < ActiveRecord::Base

  include Ckeditor::Orm::ActiveRecord::AssetBase
  delegate :url, :current_path, :content_type, to: :data
  validates :data, presence: true
end
编辑

这是我的ckeditor js ckeditor/config.js

CKEDITOR.editorConfig = function( config )
{
  config.enterMode = 2
  config.filebrowserBrowseUrl = "/ckeditor/attachment_files";
  config.filebrowserFlashBrowseUrl = "/ckeditor/attachment_files";
  config.filebrowserFlashUploadUrl = "/ckeditor/attachment_files";
  config.filebrowserImageBrowseLinkUrl = "/ckeditor/pictures";
  config.filebrowserImageBrowseUrl = "/ckeditor/pictures";
  config.filebrowserImageUploadUrl = "/ckeditor/pictures";
  config.filebrowserUploadUrl = "/ckeditor/attachment_files";
  config.toolbar_Pure = [
    '/', {
      name: 'basicstyles',
      items: ['Bold', 'Italic', 'Underline', 'Strike', 'Subscript', 'Superscript', '-', 'RemoveFormat']
    }, {
      name: 'paragraph',
      items: ['NumberedList', 'BulletedList', '-', 'Outdent', 'Indent', '-', 'Blockquote', '-', 'JustifyLeft', 'JustifyCenter', 'JustifyRight', 'JustifyBlock', '-', 'BidiLtr', 'BidiRtl']
    }, {
      name: 'links',
      items: ['Link', 'Unlink']
    }, '/', {
      name: 'styles',
      items: ['Styles', 'Format', 'Font', 'FontSize']
    }, {
      name: 'colors',
      items: ['TextColor', 'BGColor']
    }, {
      name: 'insert',
      items: ['Image', 'Table', 'HorizontalRule', 'PageBreak']
    }
  ];

  config.allowedContent = true;
  config.toolbar = 'Pure';
  return true;
}
检查

class Ckeditor::AttachmentFile < Ckeditor::Asset
  mount_uploader :data, CkeditorAttachmentFileUploader, mount_on: :data_file_name

  def url_thumb
    @url_thumb ||= Ckeditor::Utils.filethumb(filename)
  end
end
class CkeditorPictureUploader < CarrierWave::Uploader::Base
  include Ckeditor::Backend::CarrierWave
  include Cloudinary::CarrierWave
  include CarrierWave::MiniMagick

  version :thumb do
    process resize_to_fill: [118, 100]
  end

  version :content do
    process resize_to_limit: [800, 800]
  end

def extension_white_list
    Ckeditor.image_file_types
  end
end
Ckeditor.setup do |config|
  # ==> ORM configuration
  # Load and configure the ORM. Supports :active_record (default), :mongo_mapper and
  # :mongoid (bson_ext recommended) by default. Other ORMs may be
  # available as additional gems.
  require "ckeditor/orm/active_record"
config.picture_model { Ckeditor::Picture }
  #  config.attachment_file_model { Ckeditor::AttachmentFile }

   Rails.application.config.assets.precompile += %w( ckeditor/filebrowser/images/gal_del.png )

  config.cdn_url = "//cdn.ckeditor.com/4.5.6/standard/ckeditor.js"

  config.js_config_url = "/assets/ckeditor/config.js"
end
CKEDITOR.editorConfig = function( config )
{
  config.enterMode = 2
  config.filebrowserBrowseUrl = "/ckeditor/attachment_files";
  config.filebrowserFlashBrowseUrl = "/ckeditor/attachment_files";
  config.filebrowserFlashUploadUrl = "/ckeditor/attachment_files";
  config.filebrowserImageBrowseLinkUrl = "/ckeditor/pictures";
  config.filebrowserImageBrowseUrl = "/ckeditor/pictures";
  config.filebrowserImageUploadUrl = "/ckeditor/pictures";
  config.filebrowserUploadUrl = "/ckeditor/attachment_files";
  config.toolbar_Pure = [
    '/', {
      name: 'basicstyles',
      items: ['Bold', 'Italic', 'Underline', 'Strike', 'Subscript', 'Superscript', '-', 'RemoveFormat']
    }, {
      name: 'paragraph',
      items: ['NumberedList', 'BulletedList', '-', 'Outdent', 'Indent', '-', 'Blockquote', '-', 'JustifyLeft', 'JustifyCenter', 'JustifyRight', 'JustifyBlock', '-', 'BidiLtr', 'BidiRtl']
    }, {
      name: 'links',
      items: ['Link', 'Unlink']
    }, '/', {
      name: 'styles',
      items: ['Styles', 'Format', 'Font', 'FontSize']
    }, {
      name: 'colors',
      items: ['TextColor', 'BGColor']
    }, {
      name: 'insert',
      items: ['Image', 'Table', 'HorizontalRule', 'PageBreak']
    }
  ];

  config.allowedContent = true;
  config.toolbar = 'Pure';
  return true;
}
  [:extract_content_type, :set_size, :read_dimensions].each do |method|
   define_method :"#{method}_with_cloudinary" do
    send(:"#{method}_without_cloudinary") if self.file.is_a?(CarrierWave::SanitizedFile)
    {}
   end
  alias_method_chain method, :cloudinary
  end