I am new to Ruby and I found this https://github.com/drodriguez/reversegeocoding and I think it sounds really cool. So I tried the sample app, installed everything, but when I’m calling
thor geocoder:database
I get this error:
/Users/xyz/.thor/f892c2a1d732c61bbf4ebff2abb70df6:194:in `initialize': wrong number of arguments(2 for 0) (ArgumentError)
Line 194 shows
csv = FasterCSV.new(io, CSV_OPTIONS.merge(COUNTRIES_CSV_OPTIONS))
and the whole method
def insert_countries(db, countries)
ids = Hash.new
country_insert = db.prepare("INSERT INTO countries (name) VALUES (:name)")
open(countries, 'rb') do |io|
io.rewind unless io.read(3) == "\xef\xbb\xbf" # Skip UTF-8 marker
io.readline while io.read(1) == '#' # Skip comments at the start of the file
io.seek(-1, IO::SEEK_CUR) # Unread the last character that wasn't '#'
csv = FasterCSV.new(io, CSV_OPTIONS.merge(COUNTRIES_CSV_OPTIONS))
csv.each do |row|
country_insert.execute :name => row['country']
ids[row['ISO']] = db.last_insert_row_id
end
end
country_insert.close
ids
end
I don’t know how to fix this issue and I hope someone can help me with this.
Thanks.
I found the solution. The problem was my Ruby version. Since 1.9.x FasterCSV is no longer supported and now CSV is in the Ruby standard library… Look here for reference https://stackoverflow.com/a/6090840/749242