2

为了组织起来,我想要一个文件db/seeds/countries.rb

ActiveRecord::Base.connection.execute(IO.read("db/sql/countries_iso3166.sql"))

这个文件db/sql/countries_iso3166.sql有一个 SQL,当我粘贴到服务器时它运行成功,但是当我运行它时,rake db:seed我得到:

Mysql2::Error: You have an error in your SQL syntax; check the manual that
corresponds to your MySQL server version for the right syntax to use near
'INSERT INTO `countries` (`code`, `alpha2`, `alpha3`, `langCS`, `langDE`, `langEN'
at line 34:

这些是第 34 和 35 行:

34  INSERT INTO `countries` (`code`, `alpha2`, `alpha3`, `langCS`, `langDE`, `langEN`,
    `langES`, `langFR`, `langIT`, `langNL`) VALUES
35  (4, 'AF', 'AFG', 'Afghanistán', 'Afghanistan', 'Afghanistan', 'Afganistán',
    'Afghanistan', 'Afghanistan', 'Afghanistan'),
4

0 回答 0