From f2e058daa13dce7b322c9a9a2f2b74c8b7fdad77 Mon Sep 17 00:00:00 2001 From: judahsan Date: Fri, 18 Oct 2024 14:21:25 +0300 Subject: [PATCH] Revert seed file changes --- db/seeds.rb | 59 +---------------------------------------------------- 1 file changed, 1 insertion(+), 58 deletions(-) diff --git a/db/seeds.rb b/db/seeds.rb index 949bd4d..41d5257 100755 --- a/db/seeds.rb +++ b/db/seeds.rb @@ -1,7 +1,3 @@ -# frozen_string_literal: true - -require 'faker' - # frozen_string_literal: true # 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 bin/rails db:seed command (or created alongside the database with db:setup). @@ -9,57 +5,4 @@ # Examples: # # movies = Movie.create([{ name: "Star Wars" }, { name: "Lord of the Rings" }]) -# Character.create(name: "Luke", movie: movies.first) - -## User Seeds for local dev testing and setup. - -LOCATIONS = ['Nairobi', 'Mombasa', # Kenya - 'Kampala', 'Entebbe', # Uganda - 'Dar es Salaam', 'Arusha', # Tanzania - 'Bujumbura', 'Gitega', # Burundi - 'Kigali', 'Butare'].freeze # Rwanda - -def build_user - user = User.new - - user.email = Faker::Internet.email - pass = Faker::Internet.password - user.password = pass - user.password_confirmation = pass - user.github_username = Faker::Internet.username - user.name = Faker::Name.name - user.phone_number = Faker::Number.number(digits: 10) - - user.save if user.valid? -end - -def build_country - country = Country.new - - country.name = %w[Kenya Uganda Tanzania Rwanda Burundi].sample - - country.save if country.valid? -end - -def build_chapter - chapter = Chapter.new - - chapter.name = [Faker::Name.middle_name.to_s, 'Chapter'].join(' ') - chapter.country = Country.all.sample - chapter.location = LOCATIONS.sample - chapter.description = "The East African chapter in #{chapter.location}" - - chapter.save if chapter.valid? -end - -10.times do - build_user -end - -5.times do - build_country -end - -10.times do - build_chapter -end +# Character.create(name: "Luke", movie: movies.first) \ No newline at end of file