Commit 19d0dc3c042d9a2aa70094778b2f4d2237fbf015
1 parent
7ef18060
Exists in
master
and in
4 other branches
Strict first project symdol to letter
Showing
1 changed file
with
5 additions
and
5 deletions
Show diff stats
app/models/project.rb
| ... | ... | @@ -48,7 +48,7 @@ class Project < ActiveRecord::Base |
| 48 | 48 | Project.transaction do |
| 49 | 49 | project.owner = user |
| 50 | 50 | |
| 51 | - project.save! | |
| 51 | + return project unless project.save | |
| 52 | 52 | |
| 53 | 53 | # Add user as project master |
| 54 | 54 | project.users_projects.create!(:project_access => UsersProject::MASTER, :user => user) |
| ... | ... | @@ -72,8 +72,8 @@ class Project < ActiveRecord::Base |
| 72 | 72 | validates :path, |
| 73 | 73 | :uniqueness => true, |
| 74 | 74 | :presence => true, |
| 75 | - :format => { :with => /^[a-zA-Z0-9_\-\.]*$/, | |
| 76 | - :message => "only letters, digits & '_' '-' '.' allowed" }, | |
| 75 | + :format => { :with => /^[a-zA-Z][a-zA-Z0-9_\-\.]*$/, | |
| 76 | + :message => "only letters, digits & '_' '-' '.' allowed. Letter should be first" }, | |
| 77 | 77 | :length => { :within => 0..255 } |
| 78 | 78 | |
| 79 | 79 | validates :description, |
| ... | ... | @@ -82,8 +82,8 @@ class Project < ActiveRecord::Base |
| 82 | 82 | validates :code, |
| 83 | 83 | :presence => true, |
| 84 | 84 | :uniqueness => true, |
| 85 | - :format => { :with => /^[a-zA-Z0-9_\-\.]*$/, | |
| 86 | - :message => "only letters, digits & '_' '-' '.' allowed" }, | |
| 85 | + :format => { :with => /^[a-zA-Z][a-zA-Z0-9_\-\.]*$/, | |
| 86 | + :message => "only letters, digits & '_' '-' '.' allowed. Letter should be first" }, | |
| 87 | 87 | :length => { :within => 1..255 } |
| 88 | 88 | |
| 89 | 89 | validates :owner, :presence => true | ... | ... |