seeds.rb 1.1 KB

1234567891011121314151617181920212223242526272829303132
  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 rails db:seed command (or created alongside the database with db:setup).
  3. #
  4. # Examples:
  5. #
  6. # movies = Movie.create([{ name: 'Star Wars' }, { name: 'Lord of the Rings' }])
  7. # Character.create(name: 'Luke', movie: movies.first)
  8. User.create!(name: "Example User",
  9. login: "example",
  10. email: "example@example.com",
  11. password: "foobar",
  12. password_confirmation: "foobar",
  13. birth_date: 15.years.ago,
  14. phone: "(333) 333-3333")
  15. 99.times do |n|
  16. name = Faker::Name.name
  17. email = "example-#{n+1}@example.com"
  18. password = "password"
  19. login = "example_#{n+1}"
  20. birth_date = Faker::Date.between(15.years.ago, 70.years.ago)
  21. phone = Faker::PhoneNumber.cell_phone
  22. User.create!(name: name,
  23. email: email,
  24. login: login,
  25. password: password,
  26. password_confirmation: password,
  27. birth_date: birth_date,
  28. phone: phone)
  29. end