I know this has already been asked before but I couldn't find anything quite like the issue I am facing.
I am using the open() method to download and save the file.
img = Image.new
img.image = open(url)
img.save
This throws an error: Paperclip error while determining content type
I found this on SO, but I am on a linux machine so it does not apply:
paperclip Error while determining content type: Cocaine::CommandNotFoundError in Rails 3.2.1
The other way to do this is to use URI.parse(). However I faced issues with it earlier, it seems to be working fine now.
Overall the behaviour from either one open() or URI.parse() has been unpredictable. Sometimes they work sometimes they don't. What is the best one to use in this case and what fail safe strategy can I use?