diff options
| author | randx <dmitriy.zaporozhets@gmail.com> | 2012-06-28 00:47:12 +0300 |
|---|---|---|
| committer | randx <dmitriy.zaporozhets@gmail.com> | 2012-06-28 00:47:12 +0300 |
| commit | 19d0dc3c042d9a2aa70094778b2f4d2237fbf015 (patch) | |
| tree | 4264ac44849fb836be029a98c40d0e0c9fba356a /app | |
| parent | 7ef180608f87fc17f19cd66e91ae34487e5b6564 (diff) | |
| download | gitlab-ce-19d0dc3c042d9a2aa70094778b2f4d2237fbf015.tar.gz | |
Strict first project symdol to letter
Diffstat (limited to 'app')
| -rw-r--r-- | app/models/project.rb | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/app/models/project.rb b/app/models/project.rb index 5611eb608f6..9f51f4e4e46 100644 --- a/app/models/project.rb +++ b/app/models/project.rb @@ -48,7 +48,7 @@ class Project < ActiveRecord::Base Project.transaction do project.owner = user - project.save! + return project unless project.save # Add user as project master project.users_projects.create!(:project_access => UsersProject::MASTER, :user => user) @@ -72,8 +72,8 @@ class Project < ActiveRecord::Base validates :path, :uniqueness => true, :presence => true, - :format => { :with => /^[a-zA-Z0-9_\-\.]*$/, - :message => "only letters, digits & '_' '-' '.' allowed" }, + :format => { :with => /^[a-zA-Z][a-zA-Z0-9_\-\.]*$/, + :message => "only letters, digits & '_' '-' '.' allowed. Letter should be first" }, :length => { :within => 0..255 } validates :description, @@ -82,8 +82,8 @@ class Project < ActiveRecord::Base validates :code, :presence => true, :uniqueness => true, - :format => { :with => /^[a-zA-Z0-9_\-\.]*$/, - :message => "only letters, digits & '_' '-' '.' allowed" }, + :format => { :with => /^[a-zA-Z][a-zA-Z0-9_\-\.]*$/, + :message => "only letters, digits & '_' '-' '.' allowed. Letter should be first" }, :length => { :within => 1..255 } validates :owner, :presence => true |
