Skip to content

Instantly share code, notes, and snippets.

@stepheneyer
Created June 8, 2015 23:39
Show Gist options
  • Save stepheneyer/e3761a601a238b6698fd to your computer and use it in GitHub Desktop.
Save stepheneyer/e3761a601a238b6698fd to your computer and use it in GitHub Desktop.
use ffaker to populate database with fake data
# 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