title: how to save file to model from outside with carrierwave?
body: <p>I have model:</p>
  
  <pre><code>class RealtyPhoto &lt; ActiveRecord::Base
    attr_accessible :name, :photo
  
    mount_uploader :photo, RealtyPhotoUploader
  
    belongs_to :realty_object
  end
  </code></pre>
  
  <p>And uploader:</p>
  
  <pre><code>class RealtyPhotoUploader &lt; CarrierWave::Uploader::Base
  
    include CarrierWave::RMagick
  
    storage :file
  
    def store_dir
      "uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}"
    end
  
    def default_url
      [version_name, "/assets/default-flat.jpg"].compact.join('_')
    end
  
    def extension_white_list
      %w(jpg jpeg gif png)
    end
  end
  </code></pre>
  
  <p>I write in my code something like this:</p>
  
  <pre><code>require 'open-uri'
  
  object = RealtyObject.last
  
  photo = RealtyPhoto.new
  
  photo.photo = open('http://milushov.ru/bg.jpg').read
  
  object.realty_photos &lt;&lt; photo
  </code></pre>
  
  <p>And i get an error on that line:</p>
  
  <pre><code> photo.photo = open('http://milushov.ru/bg.jpg').read
  ArgumentError: string contains null byte
  from /home/roma/.rvm/gems/ruby-1.9.3-p327@miel/gems/carrierwave-0.7.1/lib/carrierwave/sanitized_file.rb:113:in `expand_path'
  </code></pre>
  
  <p>Does anybody know how to download and save file from outside? (when i save file from form on the page - all ok). Maybe using CarrierWave Uploader?</p>