2020-09-25 21:02:34 +00:00
|
|
|
# == Schema Information
|
|
|
|
#
|
2022-05-16 08:29:59 +00:00
|
|
|
# Table name: portals
|
2020-09-25 21:02:34 +00:00
|
|
|
#
|
|
|
|
# id :bigint not null, primary key
|
2022-05-16 08:29:59 +00:00
|
|
|
# archived :boolean default(FALSE)
|
2020-09-25 21:02:34 +00:00
|
|
|
# color :string
|
2022-04-20 10:30:37 +00:00
|
|
|
# config :jsonb
|
2020-09-25 21:02:34 +00:00
|
|
|
# custom_domain :string
|
|
|
|
# header_text :text
|
|
|
|
# homepage_link :string
|
|
|
|
# name :string not null
|
|
|
|
# page_title :string
|
|
|
|
# slug :string not null
|
|
|
|
# created_at :datetime not null
|
|
|
|
# updated_at :datetime not null
|
2022-04-20 10:30:37 +00:00
|
|
|
# account_id :integer not null
|
2020-09-25 21:02:34 +00:00
|
|
|
#
|
|
|
|
# Indexes
|
|
|
|
#
|
2022-05-16 08:29:59 +00:00
|
|
|
# index_portals_on_slug (slug) UNIQUE
|
2020-09-25 21:02:34 +00:00
|
|
|
#
|
2022-05-16 08:29:59 +00:00
|
|
|
class Portal < ApplicationRecord
|
2020-09-25 21:02:34 +00:00
|
|
|
belongs_to :account
|
2021-11-18 05:02:29 +00:00
|
|
|
has_many :categories, dependent: :destroy_async
|
2020-09-25 21:02:34 +00:00
|
|
|
has_many :folders, through: :categories
|
2021-11-18 05:02:29 +00:00
|
|
|
has_many :articles, dependent: :destroy_async
|
2022-05-16 08:29:59 +00:00
|
|
|
has_many :users, through: :portals_members
|
2020-09-25 21:02:34 +00:00
|
|
|
|
|
|
|
validates :account_id, presence: true
|
|
|
|
validates :name, presence: true
|
2022-04-20 10:30:37 +00:00
|
|
|
validates :slug, presence: true, uniqueness: true
|
2020-09-25 21:02:34 +00:00
|
|
|
end
|