0
나는 ckeditor를 cloudinary와 함께 사용하는 레일 4에 프로젝트를 가지고 있습니다. Cloudinary에 uplaod는 잘 작동하지만 에디터가 이미지를 젊은이시기를 업로드 한 후, 나는 오류 얻을 :레일 4 : CKEditor gsub 오류
NoMethodError - undefined method `gsub' for nil:NilClass:
내 CKEditor 사진 업 로더는 다음과 같습니다
# encoding: utf-8
class CkeditorPictureUploader < CarrierWave::Uploader::Base
include Ckeditor::Backend::CarrierWave
include Cloudinary::CarrierWave
include CarrierWave::MiniMagick
[: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
process :read_dimensions
# Create different versions of your uploaded files:
version :thumb do
process :resize_to_fill => [118, 100]
end
version :content do
process :resize_to_limit => [800, 800]
end
# Add a white list of extensions which are allowed to be uploaded.
# For images you might use something like this:
def extension_white_list
Ckeditor.image_file_types
end
end
을 업로드하고 "서버에서 이미지 찾기"를 클릭하면 이미지가 있고 편집기에 이미지를로드 할 수 있지만 이미지를 서버에 업로드 할 수 없습니다.
누군가이 문제가있어?
감사합니다.
덕분에이 코드를 넣어! lib/ckeditor 폴더는 없습니다. 나는 하나 만들어야 하나? –
방금 libs/ckeditor/asset_response.rb 파일을 만들고 거기에 코드를 넣으려고했습니다. 그러나 나는 여전히 같은 오류를 낳았다. 내 프로젝트에서 보석의 CKEDITOR 폴더를 찾을 수 없으므로 프로젝트의 LIB 폴더에이 파일을 생성해야한다고 생각합니까? –
예'lib' ckeditor/asset_response.rb 파일에 폴더를 만들고 ckeditor 폴더가 모델에 있는지 확인해야합니다. –