[Rails] file_column do download from URL

Wiktor --- iktorn at gmail.com
Thu Aug 17 20:19:04 GMT 2006


Is there a simple way of forcing file_column to download file from given 
(ex. in form) url instead of uploading it manualy?

I know:
http://blog.caboo.se/articles/2006/01/09/file_column-magick-and-versions

require 'open-uri'
Attachment.find_first.filename = open(url)
if not working as expected... what is interesting is that:

>> @a = open('http://www.google.com/intl/pl_ALL/images/logo.gif')
=> #<StringIO:0x3c22390>
>> @a = open('http://research.microsoft.com/~dcr/art/lamps/collage/P0002190.JPG')
=> #<File:C:/DOCUME~1/VALUED~1/LOCALS~1/Temp/open-uri356.2>

smaller files return StringIO
larger - File (Tempfile to be specific)

Any hints?

-- 
Posted via http://www.ruby-forum.com/.


More information about the Rails mailing list