Files
fizzy/app/models/account.rb
T
Donal McBreen fc56ad9d7c Combine uuid-old and uuid branch changes
- Switch to binary 16 for UUID keys
- Remove AccountScopedRecord base class, all model use binary uuids now
- Fix the search sql to serialize uuids properly
- Patch the MySQL schema dumper to output binary lengths
2025-11-17 09:12:34 -05:00

28 lines
631 B
Ruby

class Account < ApplicationRecord
include Entropic, Seedeable
has_one :join_code
has_many :users, dependent: :destroy
has_many :boards, dependent: :destroy
has_many :cards, through: :boards
has_many_attached :uploads
after_create :create_join_code
validates :name, presence: true
class << self
def create_with_admin_user(account:, owner:)
create!(**account).tap do |account|
User.create!(account: account, role: :system, name: "System")
User.create!(**owner.reverse_merge(role: "admin", account: account))
end
end
end
def slug
"/#{external_account_id}"
end
end