Skip to content

Instantly share code, notes, and snippets.

View RobertBornemann's full-sized avatar
☄️
Busy

Robert Bornemann RobertBornemann

☄️
Busy
View GitHub Profile
@RobertBornemann
RobertBornemann / gist:1541e80f5b8fbdc7ea2345a4539c00b9
Created May 22, 2017 19:43 — forked from arjunvenkat/gist:1115bc41bf395a162084
Seeding a Rails database with a CSV file

How to seed a Rails database with a CSV file

1. Setup

First, Create a folder inside of lib called seeds

Put your CSV file example.csv into the lib/seeds folder. In the example below, the file is called real_estate_transactions.csv

Make sure you've created a resource with the appropriate columns to match your seed data. The names don't have to match up.