def url=(url)
      extension = File.extname(url)
      file = Tempfile.new(["", extension])
      file.binmode
      file << open(url).read
      self.assign(file)
    end
def url=(url)
      extension = File.extname(url)
      file = Tempfile.new(["", extension])
      file.binmode
      file << open(url).read
      self.assign(file)
    end
Assign an attachment to a file.

 Usage:

   @object.avatar.url = "https://.../file"