Account.sole → Current.account

and some other de-tenant changes, including removing the controller
tenanting concerns
This commit is contained in:
Mike Dalessio
2025-11-10 07:58:40 -05:00
parent 6705b5225f
commit d41d50d52b
40 changed files with 67 additions and 96 deletions
@@ -15,13 +15,13 @@ ApplicationRecord.with_each_tenant do |tenant|
# Create a new Identity
Identity.transaction do
identity = Identity.create!
user.membership = identity.memberships.create!(user_id: user.id, user_tenant: user.tenant, email_address: user.email_address, account_name: Account.sole.name)
user.membership = identity.memberships.create!(user_id: user.id, user_tenant: user.tenant, email_address: user.email_address, account_name: Current.account.name)
puts "Created identity #{identity.id} for user #{user.id} (#{user.email_address})"
end
else
# Merge this User's Membership into the existing Identity
identity = memberships.first.identity
user.membership = identity.memberships.create!(user_id: user.id, user_tenant: user.tenant, email_address: user.email_address, account_name: Account.sole.name)
user.membership = identity.memberships.create!(user_id: user.id, user_tenant: user.tenant, email_address: user.email_address, account_name: Current.account.name)
puts "Merged membership for user #{user.id} (#{user.email_address}) into identity #{identity.id}"
end
end
@@ -25,7 +25,7 @@ def fix_attachments(rich_text)
end
ApplicationRecord.with_each_tenant do |tenant|
account_id = Account.sole.queenbee_id
account_id = Current.account.queenbee_id
unless account_id
puts "Skipping URL fixup for tenant: #{tenant}"
@@ -37,7 +37,7 @@ ApplicationRecord.with_each_tenant do |tenant|
domain = domains[Rails.env] || domains["production"]
regex = %r{://\w+\.#{domain}/}
pp [ Account.sole.name, account_id, domain, regex ]
pp [ Current.account.name, account_id, domain, regex ]
puts
Card.find_each do |card|