2023-05-21 17:59:36 +03:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
|
|
# == Schema Information
|
|
|
|
|
#
|
|
|
|
|
# Table name: accounts
|
|
|
|
|
#
|
|
|
|
|
# id :bigint not null, primary key
|
2023-06-30 01:26:13 +03:00
|
|
|
# locale :string not null
|
2023-05-21 17:59:36 +03:00
|
|
|
# name :string not null
|
2023-06-30 01:26:13 +03:00
|
|
|
# timezone :string not null
|
2023-05-21 17:59:36 +03:00
|
|
|
# created_at :datetime not null
|
|
|
|
|
# updated_at :datetime not null
|
|
|
|
|
#
|
|
|
|
|
class Account < ApplicationRecord
|
|
|
|
|
has_many :users, dependent: :destroy
|
|
|
|
|
has_many :encrypted_configs, dependent: :destroy
|
2023-08-16 22:57:59 +03:00
|
|
|
has_many :account_configs, dependent: :destroy
|
2023-05-31 23:19:20 +03:00
|
|
|
has_many :templates, dependent: :destroy
|
2023-08-05 15:25:16 +03:00
|
|
|
has_many :submissions, through: :templates
|
|
|
|
|
has_many :submitters, through: :submissions
|
2023-05-21 17:59:36 +03:00
|
|
|
has_many :active_users, -> { active }, dependent: :destroy,
|
|
|
|
|
inverse_of: :account, class_name: 'User'
|
2023-06-30 01:26:13 +03:00
|
|
|
|
|
|
|
|
attribute :timezone, :string, default: 'UTC'
|
|
|
|
|
attribute :locale, :string, default: 'en-US'
|
2023-05-21 17:59:36 +03:00
|
|
|
end
|