У меня есть модель (называемая Test):
property :id, Serial
property :title, String, :length => 255, :required => true
property :description, String, :length => 255, :required => true
property :brand, String, :length => 255, :required => true
property :link, String, :length => 255, :required => true
property :image_link, String, :length => 255, :required => true
property :price, String, :length => 255, :required => true
property :condition, String, :length => 255, :required => true
property :product_type, String, :length => 255, :required => true
Я импортирую данные из файла с разделителями табуляции, используя FasterCSV,
FasterCSV.foreach ("test.txt",{: headers => true,: quote_char => '"',: col_sep => '/ t'}) do | row_data |
row_data = Test.first_or_new(
'title' => :title,
'description' => :supplier,
'brand' => :brand,
'link' => :link,
'image_link' => :image_link,
'price' => :price,
'condition' => :condition,
'product_type' => :product_type
)
row_data.save
end
При запуске средства импорта ошибок не появляется. Ничего не появляется в таблице SQLite.
Я что-то упускаю из виду? (Таблица существует в целевой базе данных, и имена полей совпадают сзаголовки из моего файла.