0

I'm trying to upload a csv file with a lot of posible clients (15000) on a MySQL table. I want to keep on a table for later retrieve info, complete forms and make users.

Now i'm on the beginning, trying to import the csv to the MySQL.

I read some solutions that takes smarterCSV gem, so i must do a migration with the db structure and then execute the rake task or not needed to execute the migration for this?

The kind of code i want to use for import the csv is something like i read on before posts like Ruby on Rails - Import Data from a CSV file

require 'smarter_csv'
  options = {}
  SmarterCSV.process('input_file.csv', options) do |chunk|
    chunk.each do |data_hash|
      Moulding.create!( data_hash )
    end
  end
Community
  • 1
  • 1
Marcos R. Guevara
  • 5,258
  • 6
  • 19
  • 44

1 Answers1

1

You may use my importer gem. It also uses SmarterCSV.

https://github.com/michaelnera/active_record_importer