seeds.rb 1.2 KB

1234567891011121314151617181920212223
  1. # This file should contain all the record creation needed to seed the database with its default values.
  2. # The data can then be loaded with the rake db:seed (or created alongside the db with db:setup).
  3. #
  4. # Examples:
  5. #
  6. # cities = City.create([{ name: 'Chicago' }, { name: 'Copenhagen' }])
  7. # Mayor.create(name: 'Emanuel', city: cities.first)
  8. movies = [{:title => 'Aladdin', :rating => 'G', :release_date => '25-Nov-1992'},
  9. {:title => 'The Terminator', :rating => 'R', :release_date => '26-Oct-1984'},
  10. {:title => 'When Harry Met Sally', :rating => 'R', :release_date => '21-Jul-1989'},
  11. {:title => 'The Help', :rating => 'PG-13', :release_date => '10-Aug-2011'},
  12. {:title => 'Chocolat', :rating => 'PG-13', :release_date => '5-Jan-2001'},
  13. {:title => 'Amelie', :rating => 'R', :release_date => '25-Apr-2001'},
  14. {:title => '2001: A Space Odyssey', :rating => 'G', :release_date => '6-Apr-1968'},
  15. {:title => 'The Incredibles', :rating => 'PG', :release_date => '5-Nov-2004'},
  16. {:title => 'Raiders of the Lost Ark', :rating => 'PG', :release_date => '12-Jun-1981'},
  17. {:title => 'Chicken Run', :rating => 'G', :release_date => '21-Jun-2000'},
  18. ]
  19. movies.each do |movie|
  20. Movie.create!(movie)
  21. end