Skip to content

Instantly share code, notes, and snippets.

@tngn
tngn / seeds.rb
Last active Apr 15, 2016
A revised version of hw6_rottenpotatoes/db/seeds.rb for better control of the numbers of records generated. Syntax: rake db:seed [options] with options being one of (show, max, debug): show: displays the current numbers of movie, moviegoer, and review records; max=nn: generate up to nn movie records, nn moviegoers, and 20*nn reviews; generations…
View seeds.rb
=begin
This file should contain all the record creation needed to seed the database with its default values.
The data can then be loaded with the rake db:seed (or created alongside the db with db:setup).
Examples:
movies = [{:title => 'Aladdin', :rating => 'G', :release_date => '25-Nov-1992'},
{:title => 'The Terminator', :rating => 'R', :release_date => '26-Oct-1984'},
# ...
{:title => 'Chicken Run', :rating => 'G', :release_date => '21-Jun-review_count00'},
]