title: CKEditor Carrierwave Cloudinary
body: <p>I'm trying to get CKEditor to work with Carrierwave and Cloudinary. So far, non-CKEditor enabled views with a regular file upload field are working perfectly with Carrierwave &amp; Cloudinary. However, when I try to upload a file in CKEditor and "Send it to the Server" I'm getting a <code>NoMethodError - undefined method 'each' for "image/jpeg":String:</code></p>
  
  <p>Prior to removing the local storage config from the CKEditor classes it was working, but saving the file locally. </p>
  
  <p><strong>Here is my current CKEditor uploader:</strong></p>
  
  <pre><code>class CkeditorAttachmentFileUploader &lt; CarrierWave::Uploader::Base
    include Cloudinary::CarrierWave
    include Ckeditor::Backend::CarrierWave
  
    def extension_white_list
      Ckeditor.attachment_file_types
    end
  end
  </code></pre>
  
  <p><strong>Log file:</strong></p>
  
  <pre><code>Started POST "/ckeditor/pictures?CKEditor=subsection_content&amp;CKEditorFuncNum=3&amp;langCode=en&amp;authenticity_token=5Bt06UwjUD%2FEdLFANBmZojdv8Hvn2GbQRLvC6h11Dd8%3D" for 127.0.0.1 at 2013-06-20 15:44:18 -0700
  Processing by Ckeditor::PicturesController#create as HTML
    Parameters: {"upload"=&gt;#&lt;ActionDispatch::Http::UploadedFile:0x007ff742c77018 @original_filename="pic1.jpg", @content_type="image/jpeg", @headers="Content-Disposition: form-data; name=\"upload\"; filename=\"pic1.jpg\"\r\nContent-Type: image/jpeg\r\n", @tempfile=#&lt;Tempfile:/var/folders/0t/l1qc3j596v77_z3s8f2pm75w0000gn/T/RackMultipart20130620-18566-i0av53&gt;&gt;, "CKEditor"=&gt;"subsection_content", "CKEditorFuncNum"=&gt;"3", "langCode"=&gt;"en", "authenticity_token"=&gt;"5Bt06UwjUD/EdLFANBmZojdv8Hvn2GbQRLvC6h11Dd8="}
     (0.4ms)  BEGIN
     (0.4ms)  ROLLBACK
  Completed 500 Internal Server Error in 4ms
  
  NoMethodError - undefined method `each' for "image/jpeg":String:
    (gem) cloudinary-1.0.59/lib/cloudinary/carrier_wave/process.rb:100:in `block in transformation'
  </code></pre>
  
  <p>Any ideas appreciated!</p>
  
  <p><strong>UPDATE - Working config from Tal Lev-Ami answer</strong></p>
  
  <p>This is my current, working <code>ckeditor_picture_uploader.rb</code> file:</p>
  
  <pre><code># encoding: utf-8
  class CkeditorPictureUploader &lt; CarrierWave::Uploader::Base
    include Ckeditor::Backend::CarrierWave
    include Cloudinary::CarrierWave
  
    # Include RMagick or ImageScience support:
    # include CarrierWave::RMagick
    include CarrierWave::MiniMagick
    # include CarrierWave::ImageScience
  
    # Choose what kind of storage to use for this uploader:
    # storage :file
  
    # Override the directory where uploaded files will be stored.
    # This is a sensible default for uploaders that are meant to be mounted:
    # def store_dir
    #   "uploads/ckeditor/pictures/#{model.id}"
    # end
  
    # Provide a default URL as a default if there hasn't been a file uploaded:
    # def default_url
    #   "/images/fallback/" + [version_name, "default.png"].compact.join('_')
    # end
  
    # Process files as they are uploaded:
    # process :scale =&gt; [200, 300]
    #
    # def scale(width, height)
    #   # do something
    # end
  
    [: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 =&gt; [118, 100]
    end
  
    version :content do
      process :resize_to_limit =&gt; [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
  </code></pre>