title: CarrierWave Add ActionDispatch::Http::UploadedFile After Model Processing
body: <p>I have an <code>Image</code> model that requires me to have some data set up before I can save the image, because I determine where to upload the image to and what to name it depending on some data from the model. Right now I'm trying to do:</p>
  
  <pre><code># ImagesController sets up data
  img = Image.new
  img.imageable = user
  phashion_img = Phashion::Image.new(file.path)
  img.image_hash = phashion_img.fingerprint.to_s
  img.batch = img.latest_batch + 1
  img.extension = 'jpg'
  img.height = 640
  img.width = 640
  
  # ImageUploader uses it
  version :original do
    def full_filename
      "#{model.image_hash}/orig/#{alnum_encode(model.imageable.id)}.#{model.extension}"
    end
  end
  </code></pre>
  
  <p>I've run into an issue trying to pass the uploaded image into the uploader. </p>
  
  <p><code>img.uploader.store! file</code> gives me the error <code>wrong number of arguments (1 for 0)</code>
  <code>img.uploader.store! file.tempfile</code> gives me <code>You are not allowed to upload "" files, allowed types: jpg, jpeg, gif, png</code></p>
  
  <p>For reference, <code>file</code> is:</p>
  
  <pre><code>#&lt;ActionDispatch::Http::UploadedFile:0x00000109ccdb70 @tempfile=#&lt;Tempfile:/var/folders/lx/xk8vzr4s0fdd_m5w0syftfl80000gn/T/RackMultipart20140723-28731-1b5weu8&gt;, @original_filename="20140522_164844.jpg", @content_type="image/jpeg", @headers="Content-Disposition: form-data; name=\"user[images_attributes][0][uploader]\"; filename=\"20140522_164844.jpg\"\r\nContent-Type: image/jpeg\r\n"&gt;
  </code></pre>
  
  <p>Which would make file.tempfile:</p>
  
  <pre><code>#&lt;Tempfile:/var/folders/lx/xk8vzr4s0fdd_m5w0syftfl80000gn/T/RackMultipart20140723-28731-1b5weu8&gt;
  </code></pre>
  
  <p>Is there any way I could pass either of these objects, <code>ActionDispatch::Http::UploadedFile</code> or <code>Tempfile</code>, to the Carrierwave uploader? Some transformation I can do to them so that the uploader can accept one of them?</p>