2

私は Ruby を初めて使用し、これを見つけましたhttps://github.com/drodriguez/reversegeocodingは本当にクールだと思います。というわけで、サンプルアプリを試して、全部インストールしたのですが、電話をしているときに

 thor geocoder:database

次のエラーが表示されます。

/Users/xyz/.thor/f892c2a1d732c61bbf4ebff2abb70df6:194:in `initialize': wrong number of arguments(2 for 0) (ArgumentError)

ライン 194 ショー

csv = FasterCSV.new(io, CSV_OPTIONS.merge(COUNTRIES_CSV_OPTIONS))

そして全体の方法

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

この問題を解決する方法がわかりません。誰かが私を助けてくれることを願っています。

ありがとう。

4

1 に答える 1

1

私は解決策を見つけました。問題は私のRubyバージョンでした。1.9.x FasterCSVはサポートされなくなり、CSVはRuby標準ライブラリに含まれるようになりました...参照先はこちらhttps://stackoverflow.com/a/6090840/749242

于 2013-01-05T17:12:35.453 に答える