Created
June 8, 2015 23:39
-
-
Save stepheneyer/e3761a601a238b6698fd to your computer and use it in GitHub Desktop.
use ffaker to populate database with fake data
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Use the Great Faker Cheatsheet as a reference | |
# http://ricostacruz.com/cheatsheets/ffaker.html | |
require 'ffaker' | |
require 'pg' | |
conn = PG.connect(dbname: "shopper_app") | |
conn.exec("INSERT INTO shoppers | |
(first_name, last_name, email, address) | |
VALUES | |
($1, $2, $3, $4)", | |
[FFaker::Name.first_name, FFaker::Name.last_name, FFaker::Internet.email, FFaker::Address.street_address]); | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment