From d2cd20fe5b20618f61e2fe7ea4be7efaaa5a010f Mon Sep 17 00:00:00 2001 From: Jorge Manrubia Date: Wed, 2 Apr 2025 11:17:23 +0200 Subject: [PATCH] Add script to populate some buckets and cards --- script/populate/buckets_and_bubbles.rb | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 script/populate/buckets_and_bubbles.rb diff --git a/script/populate/buckets_and_bubbles.rb b/script/populate/buckets_and_bubbles.rb new file mode 100644 index 000000000..d247f65b9 --- /dev/null +++ b/script/populate/buckets_and_bubbles.rb @@ -0,0 +1,17 @@ +require_relative "../../config/environment" + +BUCKETS_COUNT = 100 +BUBBLES_PER_BUCKET = 50 + +ApplicationRecord.current_tenant = "development-tenant" +account = Account.first +user = account.users.first +Current.session = user.sessions.last +workflow = account.workflows.first + +BUCKETS_COUNT.times do |bucket_index| + bucket = account.buckets.create!(name: "Collection #{bucket_index}", creator: user, workflow: workflow) + BUBBLES_PER_BUCKET.times do |card_index| + bucket.bubbles.create!(title: "Card #{card_index}", creator: user, status: :published) + end +end