I can't get this to work. I want to pull a CSV file from another web server for reading in my application. Here is what I would like to call it:
url = 'http://www.testing.com/test.csv'
records = FasterCSV.read(url, :headers => true, :header_converters => :symbol)
But that does not work. I tried Googling, and all I came up with was this excerpt: Practical Ruby Gems
So, I tried to change it as follows:
require 'open-uri'
url = 'http://www.testing.com/test.csv'
csv_url = open(url)
records = FasterCSV.read(csv_url, :headers => true, :header_converters => :symbol)
... and I get an error can't convert Tempfile into String
(coming from the FasterCSV gem).
Can someone tell me how to make this work?
source
share