Namespace model added. Migration to convert exit project/groups
This commit is contained in:
parent
ced242a2d0
commit
e29ccece33
6 changed files with 60 additions and 31 deletions
|
@ -32,7 +32,8 @@ class Project < ActiveRecord::Base
|
|||
attr_accessor :error_code
|
||||
|
||||
# Relations
|
||||
belongs_to :group
|
||||
belongs_to :group, foreign_key: "namespace_id", conditions: 'type = Group'
|
||||
belongs_to :namespace
|
||||
belongs_to :owner, class_name: "User"
|
||||
has_many :users, through: :users_projects
|
||||
has_many :events, dependent: :destroy
|
||||
|
@ -192,4 +193,12 @@ class Project < ActiveRecord::Base
|
|||
def gitlab_ci?
|
||||
gitlab_ci_service && gitlab_ci_service.active
|
||||
end
|
||||
|
||||
def path_with_namespace
|
||||
if namespace
|
||||
namespace.code + '/' + path
|
||||
else
|
||||
path
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue