Create dir with namespace. Create namespace with user

This commit is contained in:
Dmitriy Zaporozhets 2012-11-23 09:11:09 +03:00
parent f17ddeb394
commit ab9d023651
6 changed files with 39 additions and 26 deletions

View file

@ -67,6 +67,7 @@ class Project < ActiveRecord::Base
message: "only letters, digits & '_' '-' '.' allowed. Letter should be first" }
validates :issues_enabled, :wall_enabled, :merge_requests_enabled,
:wiki_enabled, inclusion: { in: [true, false] }
validate :check_limit, :repo_name
# Scopes
@ -89,6 +90,12 @@ class Project < ActiveRecord::Base
project = Project.new params
Project.transaction do
# Build gitlab-hq code from GitLab HQ name
#
slug = project.name.dup.parameterize
project.code = project.path = slug
project.owner = user
project.namespace_id = namespace_id
project.save!