diff --git a/db/dev_seeds/budgets.rb b/db/dev_seeds/budgets.rb index 883919962..25e33cbbc 100644 --- a/db/dev_seeds/budgets.rb +++ b/db/dev_seeds/budgets.rb @@ -91,7 +91,7 @@ section "Marking investments as visible to valuators" do end section "Geolocating Investments" do - Budget.all.each do |budget| + Budget.find_each do |budget| budget.investments.each do |investment| MapLocation.create(latitude: Setting['map_latitude'].to_f + rand(-10..10)/100.to_f, longitude: Setting['map_longitude'].to_f + rand(-10..10)/100.to_f, @@ -140,7 +140,7 @@ section "Creating Valuation Assignments" do end section "Creating investment milestones" do - Budget::Investment.all.each do |investment| + Budget::Investment.find_each do |investment| milestone = Budget::Investment::Milestone.new(investment_id: investment.id, publication_date: Date.tomorrow) I18n.available_locales.map do |locale| neutral_locale = locale.to_s.downcase.underscore.to_sym diff --git a/db/dev_seeds/communities.rb b/db/dev_seeds/communities.rb index 776ba1b27..10550591a 100644 --- a/db/dev_seeds/communities.rb +++ b/db/dev_seeds/communities.rb @@ -1,10 +1,10 @@ section "Creating Communities" do - Proposal.all.each { |proposal| proposal.update(community: Community.create) } - Budget::Investment.all.each { |investment| investment.update(community: Community.create) } + Proposal.find_each { |proposal| proposal.update(community: Community.create) } + Budget::Investment.find_each { |investment| investment.update(community: Community.create) } end section "Creating Communities Topics" do - Community.all.each do |community| + Community.find_each do |community| Topic.create(community: community, author: User.all.sample, title: Faker::Lorem.sentence(3).truncate(60), description: Faker::Lorem.sentence) end diff --git a/db/dev_seeds/legislation_processes.rb b/db/dev_seeds/legislation_processes.rb index 932f93fd8..d65e7cb3b 100644 --- a/db/dev_seeds/legislation_processes.rb +++ b/db/dev_seeds/legislation_processes.rb @@ -23,7 +23,7 @@ section "Creating legislation processes" do published: true) end - Legislation::Process.all.each do |process| + Legislation::Process.find_each do |process| (1..3).each do |i| process.draft_versions.create!(title: "Version #{i}", body: Faker::Lorem.paragraphs.join("\n\n")) diff --git a/db/dev_seeds/notifications.rb b/db/dev_seeds/notifications.rb index bb87e8603..3d7282f4a 100644 --- a/db/dev_seeds/notifications.rb +++ b/db/dev_seeds/notifications.rb @@ -1,5 +1,5 @@ section "Creating comment notifications" do - User.all.each do |user| + User.find_each do |user| debate = Debate.create!(author: user, title: Faker::Lorem.sentence(3).truncate(60), description: "
#{Faker::Lorem.paragraphs.join('
')}
", diff --git a/db/dev_seeds/polls.rb b/db/dev_seeds/polls.rb index 7d80c2559..188efe4fd 100644 --- a/db/dev_seeds/polls.rb +++ b/db/dev_seeds/polls.rb @@ -31,7 +31,7 @@ section "Creating polls" do end section "Creating Poll Questions & Answers" do - Poll.all.each do |poll| + Poll.find_each do |poll| (1..4).to_a.sample.times do question = Poll::Question.create!(author: User.all.sample, title: Faker::Lorem.sentence(3).truncate(60) + '?', @@ -55,10 +55,10 @@ section "Creating Poll Booths & BoothAssignments" do end section "Creating Poll Shifts for Poll Officers" do - Poll.all.each do |poll| + Poll.find_each do |poll| Poll::BoothAssignment.where(poll: poll).each do |booth_assignment| scrutiny = (poll.ends_at.to_datetime..poll.ends_at.to_datetime + Poll::RECOUNT_DURATION) - Poll::Officer.all.each do |poll_officer| + Poll::Officer.find_each do |poll_officer| { vote_collection: (poll.starts_at.to_datetime..poll.ends_at.to_datetime), recount_scrutiny: scrutiny @@ -130,7 +130,7 @@ section "Creating Poll Voters" do end section "Creating Poll Recounts" do - Poll.all.each do |poll| + Poll.find_each do |poll| poll.booth_assignments.each do |booth_assignment| officer_assignment = poll.officer_assignments.first author = Poll::Officer.first.user @@ -148,7 +148,7 @@ section "Creating Poll Recounts" do end section "Creating Poll Results" do - Poll.all.each do |poll| + Poll.find_each do |poll| poll.booth_assignments.each do |booth_assignment| officer_assignment = poll.officer_assignments.first author = Poll::Officer.first.user