Files
fizzy/script/closureulate/collections_and_cards.rb
T
Mike Dalessio 8e13ce5b78 Drop Current.account and just use Account.sole
I had reintroduced this in dacb53b8 after David removed it in
6bbf68a4, but now I agree we don't need it.

Also, fix a CORS error when trying to redirect a user to an untenanted
path after login (see
https://fizzy.37signals.com/5986089/collections/2/cards/1032).
2025-07-20 13:00:09 -04:00

18 lines
578 B
Ruby

require_relative "../../config/environment"
COLLECTIONS_COUNT = 100
CARDS_PER_COLLECTION = 50
ApplicationRecord.current_tenant = "development-tenant"
account = Account.sole
user = account.users.first
Current.session = user.sessions.last
workflow = account.workflows.first
COLLECTIONS_COUNT.times do |collection_index|
collection = Collection.create!(name: "Collection #{collection_index}", creator: user, workflow: workflow)
CARDS_PER_COLLECTION.times do |card_index|
collection.cards.create!(title: "Card #{card_index}", creator: user, status: :published)
end
end