lundi 18 juillet 2016

CSV not working with carrierwave downloaded file object

I am uploading file with csv format over rack using carrierwave in my rails controller.

Once upload, I use url(cdn) in my worker for download that file from rack and use it in my worker using following line:

file = CarrierWave::Uploader::Download::RemoteFile.new(<url(cdn)>)

Now I am having object of carrierwave which is having reference of CSV file which is uploaded to rack something like below:

#<CarrierWave::Uploader::Download::RemoteFile:0x007ffac0ab5050 @uri="<URL of rack>">

I am using this file object with methods with CSV class like below:

CSV.foreach(file, headers: false) do |row|
  puts row
end

I am getting following error:

*** TypeError Exception: no implicit conversion of CarrierWave::Uploader::Download::RemoteFile into String

nil

Any help would be appreciated!

Aucun commentaire:

Enregistrer un commentaire