title: Paperclip doesn't store in a proper format fetched image by url
body: <p>When I trying to fetch a facebook image by the graph URL(<a href="https://graph.facebook.com" rel="nofollow">https://graph.facebook.com</a>), paperclip  stores avatar_image_name as "picture" in the database. The example of code:</p>
  
  <pre><code>img =  UserImages.new
  img.avatar = URI.parse('https://graph.facebook.com/666980153384194/picture?type=large')
  img.save
  </code></pre>
  
  <p>The  MySQL query in a console log:</p>
  
  <pre><code>=&gt; #&lt;URI::HTTPS:0x00000009954490 URL:https://graph.facebook.com/666980153384194/picture?type=large&gt;
  irb(main):009:0&gt; img.save
     (0.0ms)  BEGIN
    SQL (0.0ms)  INSERT INTO `user_images` (`avatar_content_type`, `avatar_file_name`, `avatar_file_size`, `avatar_updated
  _at`, `created_at`, `updated_at`) VALUES ('image/jpeg', 'picture', 6157, '2014-07-08 13:55:53', '2014-07-08 13:56:02', '
  2014-07-08 13:56:02')
     (29.1ms)  COMMIT
  </code></pre>
  
  <p>As you can see fetched image file stored by the name 'picture'. But if to fetch image by Direct URL like: </p>
  
  <pre><code>https://scontent-a-lax.xx.fbcdn.net/hphotos-prn2/v/t1.0-9/10478546_662150043867205_2640371404472615909_n.jpg?oh=cb2fe9d421fef3d7d2220bb48a2a36e2&amp;oe=5418E8FB 
  </code></pre>
  
  <p>The fetched image stored as:</p>
  
  <pre><code>   (0.0ms)  BEGIN
  Command :: file -b --mime "C:/Users/Windows/AppData/Local/Temp/f1620d075c0642a77f7b98e532d8a8eb20140708-1040-1h5z4e6.jpg
  "
    SQL (1.0ms)  INSERT INTO `user_images` (`avatar_content_type`, `avatar_file_name`, `avatar_file_size`, `avatar_updated
  _at`, `created_at`, `updated_at`) VALUES ('image/jpeg', '10478546_662150043867205_2640371404472615909_n.jpg', 25862, '20
  14-07-08 14:02:45', '2014-07-08 14:02:49', '2014-07-08 14:02:49')
     (34.1ms)  COMMIT
  =&gt; true
  </code></pre>
  
  <p>Any advise(solution) will be highly appreciated.</p>
  
  <p>The source of  UserImages class:</p>
  
  <pre><code>  class UserImages &lt; ActiveRecord::Base
      belongs_to :imageable ,polymorphic: true
      has_attached_file :avatar,
                        :styles =&gt; { :medium =&gt; "300x300&gt;", :thumb =&gt; "125x125&gt;" },
                        :path =&gt; ":rails_root/public/images/users/:id/:style/:hash.:extension",
                        :default_url =&gt; "/images/normal/missing.jpg",
                        :url =&gt; "/images/users/:id/:style/:hash.:extension",
                        :hash_secret =&gt; "EWRWerrew234UTY"
  
      validates_attachment :avatar, :content_type =&gt;  { :content_type =&gt; ["image/jpeg", "image/gif", "image/png"] },
                                        :size =&gt; { :in =&gt; 0..5.megabytes }
  
    end
  </code></pre>