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

@ -10,6 +10,8 @@ class Namespace < ActiveRecord::Base
delegate :name, to: :owner, allow_nil: true, prefix: true
after_save :ensure_dir_exist
scope :root, where('type IS NULL')
def self.search query
@ -23,4 +25,9 @@ class Namespace < ActiveRecord::Base
def human_name
owner_name
end
def ensure_dir_exist
namespace_dir_path = File.join(Gitlab.config.git_base_path, code)
Dir.mkdir(namespace_dir_path) unless File.exists?(namespace_dir_path)
end
end