2021-11-11 11:23:49 +05:30
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
module Namespaces
|
|
|
|
class ProjectNamespace < Namespace
|
2022-07-23 23:45:48 +05:30
|
|
|
# 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-11-11 11:23:49 +05:30
|
|
|
has_one :project, foreign_key: :project_namespace_id, inverse_of: :project_namespace
|
|
|
|
|
|
|
|
def self.sti_name
|
|
|
|
'Project'
|
|
|
|
end
|
2022-01-26 12:08:38 +05:30
|
|
|
|
|
|
|
def self.polymorphic_name
|
|
|
|
'Namespaces::ProjectNamespace'
|
|
|
|
end
|
2021-11-11 11:23:49 +05:30
|
|
|
end
|
|
|
|
end
|