Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Léo-Paul Géneau
gitlab-ce
Commits
b3c1d0d8
Commit
b3c1d0d8
authored
Dec 06, 2013
by
Dmitriy Zaporozhets
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added allow_blank to model validations
Signed-off-by:
Dmitriy Zaporozhets
<
dmitriy.zaporozhets@gmail.com
>
parent
acbac26a
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
5 additions
and
3 deletions
+5
-3
app/controllers/application_controller.rb
app/controllers/application_controller.rb
+2
-0
app/models/project.rb
app/models/project.rb
+2
-2
app/models/user.rb
app/models/user.rb
+1
-1
No files found.
app/controllers/application_controller.rb
View file @
b3c1d0d8
require
'gon'
class
ApplicationController
<
ActionController
::
Base
class
ApplicationController
<
ActionController
::
Base
before_filter
:authenticate_user!
before_filter
:authenticate_user!
before_filter
:reject_blocked!
before_filter
:reject_blocked!
...
...
app/models/project.rb
View file @
b3c1d0d8
...
@@ -77,7 +77,7 @@ class Project < ActiveRecord::Base
...
@@ -77,7 +77,7 @@ class Project < ActiveRecord::Base
# Validations
# Validations
validates
:creator
,
presence:
true
validates
:creator
,
presence:
true
validates
:description
,
length:
{
within:
0
..
2000
}
validates
:description
,
length:
{
maximum:
2000
},
allow_blank:
true
validates
:name
,
presence:
true
,
length:
{
within:
0
..
255
},
validates
:name
,
presence:
true
,
length:
{
within:
0
..
255
},
format:
{
with:
Gitlab
::
Regex
.
project_name_regex
,
format:
{
with:
Gitlab
::
Regex
.
project_name_regex
,
message:
"only letters, digits, spaces & '_' '-' '.' allowed. Letter or digit should be first"
}
message:
"only letters, digits, spaces & '_' '-' '.' allowed. Letter or digit should be first"
}
...
@@ -87,7 +87,7 @@ class Project < ActiveRecord::Base
...
@@ -87,7 +87,7 @@ class Project < ActiveRecord::Base
message:
"only letters, digits & '_' '-' '.' allowed. Letter or digit should be first"
}
message:
"only letters, digits & '_' '-' '.' allowed. Letter or digit should be first"
}
validates
:issues_enabled
,
:wall_enabled
,
:merge_requests_enabled
,
validates
:issues_enabled
,
:wall_enabled
,
:merge_requests_enabled
,
:wiki_enabled
,
inclusion:
{
in:
[
true
,
false
]
}
:wiki_enabled
,
inclusion:
{
in:
[
true
,
false
]
}
validates
:issues_tracker_id
,
length:
{
within:
0
..
255
}
validates
:issues_tracker_id
,
length:
{
maximum:
255
},
allow_blank:
true
validates
:namespace
,
presence:
true
validates
:namespace
,
presence:
true
validates_uniqueness_of
:name
,
scope: :namespace_id
validates_uniqueness_of
:name
,
scope: :namespace_id
...
...
app/models/user.rb
View file @
b3c1d0d8
...
@@ -104,7 +104,7 @@ class User < ActiveRecord::Base
...
@@ -104,7 +104,7 @@ class User < ActiveRecord::Base
#
#
validates
:name
,
presence:
true
validates
:name
,
presence:
true
validates
:email
,
presence:
true
,
format:
{
with:
/\A([^@\s]+)@((?:[-a-z0-9]+\.)+[a-z]{2,})\Z/
}
validates
:email
,
presence:
true
,
format:
{
with:
/\A([^@\s]+)@((?:[-a-z0-9]+\.)+[a-z]{2,})\Z/
}
validates
:bio
,
length:
{
within:
0
..
255
}
validates
:bio
,
length:
{
maximum:
255
},
allow_blank:
true
validates
:extern_uid
,
allow_blank:
true
,
uniqueness:
{
scope: :provider
}
validates
:extern_uid
,
allow_blank:
true
,
uniqueness:
{
scope: :provider
}
validates
:projects_limit
,
presence:
true
,
numericality:
{
greater_than_or_equal_to:
0
}
validates
:projects_limit
,
presence:
true
,
numericality:
{
greater_than_or_equal_to:
0
}
validates
:username
,
presence:
true
,
uniqueness:
true
,
validates
:username
,
presence:
true
,
uniqueness:
true
,
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment