Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save k41n3w/a3ce96b6fedc1abcc50edb2c63d4ac1b to your computer and use it in GitHub Desktop.
Save k41n3w/a3ce96b6fedc1abcc50edb2c63d4ac1b to your computer and use it in GitHub Desktop.
importando-dados-com-rails-na-velocidade-da-luz-2
file_path = 'caminho/para/seu/arquivo.csv'
users_data = []
CSV.foreach(file_path, headers: true) do |row|
users_data << {name: row['name'], email: row['email']}
end
User.insert_all(users_data)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment