From 896f91e2497643511f7b6fcd689bd2e08559c40d Mon Sep 17 00:00:00 2001 From: Bertocq Date: Thu, 9 Nov 2017 13:04:54 +0100 Subject: [PATCH] Refactor Booth and Booth Assignment creation into just one section --- db/dev_seeds.rb | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/db/dev_seeds.rb b/db/dev_seeds.rb index ed56c8e01..9ee94cfc1 100644 --- a/db/dev_seeds.rb +++ b/db/dev_seeds.rb @@ -581,15 +581,9 @@ section "Creating Poll Questions & Answers" do end end -section "Creating Poll Booths" do - 20.times.each_with_index do |i| - Poll::Booth.create(name: "Booth #{i}", polls: [Poll.all.sample]) - end -end - -section "Creating Booth Assignments" do - Poll::Booth.all.each do |booth| - Poll::BoothAssignment.create(booth: booth, poll: Poll.all.sample) +section "Creating Poll Booths & BoothAssignments" do + 20.times do |i| + Poll::Booth.create(name: "Booth #{i}", location: Faker::Address.street_address, polls: [Poll.all.sample]) end end