Skip to content

Instantly share code, notes, and snippets.

View garceau's full-sized avatar

Garceau garceau

  • Los Angeles, CA
View GitHub Profile
@garceau
garceau / gist:f94c45e9235e49b6ee49297bb0067c83
Created January 30, 2018 12:55 — 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.