Issue #83 - Project limit

This commit is contained in:
Valera Sizov 2011-10-09 11:15:01 -07:00
parent 9840102651
commit 67f0c62d07
13 changed files with 45 additions and 9 deletions

View file

@ -25,6 +25,8 @@ class Project < ActiveRecord::Base
:uniqueness => true,
:length => { :within => 3..12 }
validate :check_limit
before_save :format_code
after_destroy :destroy_gitosis_project
after_save :update_gitosis_project
@ -126,6 +128,12 @@ class Project < ActiveRecord::Base
path ? (tree / path) : tree
end
def check_limit
unless owner.can_create_project?
errors[:base] << ("You can to have #{owner.projects_limit} your own projects")
end
end
def valid_repo?
repo
rescue