2021-09-03 08:09:03 -04:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
module Namespaces
|
|
|
|
class ProjectNamespace < Namespace
|
2022-05-25 23:09:21 -04:00
|
|
|
# These aliases are added to make it easier to sync parent/parent_id attribute with
|
|
|
|
# project.namespace/project.namespace_id attribute.
|
|
|
|
#
|
|
|
|
# TODO: we can remove these attribute aliases when we no longer need to sync these with project model,
|
|
|
|
# see project#sync_attributes
|
|
|
|
alias_attribute :namespace, :parent
|
|
|
|
alias_attribute :namespace_id, :parent_id
|
2021-09-03 08:09:03 -04:00
|
|
|
has_one :project, foreign_key: :project_namespace_id, inverse_of: :project_namespace
|
2021-09-08 17:10:58 -04:00
|
|
|
|
|
|
|
def self.sti_name
|
|
|
|
'Project'
|
|
|
|
end
|
2021-12-09 04:11:03 -05:00
|
|
|
|
|
|
|
def self.polymorphic_name
|
|
|
|
'Namespaces::ProjectNamespace'
|
|
|
|
end
|
2021-09-03 08:09:03 -04:00
|
|
|
end
|
|
|
|
end
|