ga-wdi-boston / rails-api-one-to-many

Other
0 stars 92 forks source link

Add example data in examples.rb to these repos #10

Open payne-chris-r opened 8 years ago

payne-chris-r commented 8 years ago

I'm not sure where this goes, but dumping some starter data into these repos for between days would make our lives (and theirs) easier.

# This file should contain all the record creation needed to experiment with
# your app during development.
#
# The data can then be loaded with the rake db:examples (or created alongside
# the db with db:nuke_pave).
#
# Examples:
#
#   cities = City.create([{ name: 'Chicago' }, { name: 'Copenhagen' }])
#   Mayor.create(name: 'Emanuel', city: cities.first)

# %w(antony jeff matt jason).each do |name|
#   email = "#{name}@#{name}.com"
#   next if User.exists? email: email
#   User.create!(email: email,
#                password: 'abc123',
#                password_confirmation: nil)
# end

Patient.create([
                 { name: 'Jeff Horn',
                   sickness: 'Too cool for school' },
                 { name: 'Chris Payne',
                   sickness: 'Way to excited' },
                 { name: 'Brian Berzellini',
                   sickness: 'Spooky Ghost' },
                 { name: 'Antony Donovan',
                   sickness: 'Robot Syndrome' },
                 { name: 'Jason Weeks',
                   sickness: 'Oddly large chest' }
               ])

# Doctor.create([
#                 { given_name: 'Ben',
#                   surname: 'Adamski',
#                   specialty: 'VapeKing' },
#                 { given_name: 'Rachel',
#                   surname: 'Stevens',
#                   specialty: 'Horse Enthusiast' },
#                 { given_name: 'Julie',
#                   surname: 'Carroll',
#                   specialty: 'Getting everyone jobs' },
#                 { given_name: 'Lu',
#                   surname: 'Nathan',
#                   specialty: 'iPhone guru' },
#                 { given_name: 'Naida',
#                   surname: 'the Pollster',
#                   specialty: 'Keeping us all caffinated' }
#               ])
#
# Patient.create([
#                  { name: 'Jeff Horn',
#                    sickness: 'Too cool for school',
#                    doctor_id: 2 },
#                  { name: 'Chris Payne',
#                    sickness: 'Way to excited',
#                    doctor_id: 2 },
#                  { name: 'Brian Berzellini',
#                    sickness: 'Spooky Ghost' },
#                  { name: 'Antony Donovan',
#                    sickness: 'Robot Syndrome',
#                    doctor_id: 1 },
#                  { name: 'Jason Weeks',
#                    sickness: 'Oddly large chest',
#                    doctor_id: 4 }
#                ])
# This file should contain all the record creation needed to experiment with
# your app during development.
#
# The data can then be loaded with the rake db:examples (or created alongside
# the db with db:nuke_pave).
#
# Examples:
#
#   cities = City.create([{ name: 'Chicago' }, { name: 'Copenhagen' }])
#   Mayor.create(name: 'Emanuel', city: cities.first)

# %w(antony jeff matt jason).each do |name|
#   email = "#{name}@#{name}.com"
#   next if User.exists? email: email
#   User.create!(email: email,
#                password: 'abc123',
#                password_confirmation: nil)
# end

Book.create(
  [
    { title: 'There and back again', author: 'Bilbo Baggins' },
    { title: '50 Shades of GA', author: 'Some Guy from Bahstahn' },
    { title: 'Antony Potter and the Prisoner of WDI' },
    { title: 'Example Title Numbah Two, Kid!', author: 'Big Papi' },
    { title: 'A Wacky Title' },
    { title: 'One Fish, Two Fish, Red Fish, Blue Fish', author: 'Dr Seuss' },
    { title: 'The BFG', author: 'Roald Dahl' },
    { title: 'Matilda', author: 'Roald Dahl' }
  ]
)

# Author.create(
#   [
#     { given_name: 'Roald', surname: 'Dahl' },
#     { given_name: 'Dr', surname: 'Seuss' },
#     { given_name: 'Bilbo', surname: 'Baggins' },
#     { given_name: 'Big', surname: 'Papi' },
#     { given_name: 'Some Guy From', surname: 'Bahstahn' }
#   ]
# )

# Book.create(
#   [
#     { title: 'There and back again', author_id: 3 },
#     { title: '50 Shades of GA', author_id: 4 },
#     { title: 'Antony Potter and the Prisoner of WDI' },
#     { title: 'Example Title Numbah Two, Kid!', author_id: 5 },
#     { title: 'A Wacky Title' },
#     { title: 'One Fish, Two Fish, Red Fish, Blue Fish', author_id: 2 },
#     { title: 'The BFG', author_id: 1 },
#     { title: 'Matilda', author_id: 1 }
#   ]
# )
antleo1995 commented 7 years ago

{ name: 'Chris Payne', sickness: 'Way to excited' }, should be 'Way toO excited' Learn to spell! lol <- Jeff told me to say that. ;)

jrhorn424 commented 7 years ago

Examples should be idempotent. See: https://github.com/ga-wdi-boston/rails-api-library-demo/blob/jrh/solution/db/examples.rb#L38