summaryrefslogtreecommitdiff
path: root/app/models/namespace.rb
diff options
context:
space:
mode:
authorRémy Coutable <remy@rymai.me>2016-12-02 13:54:57 +0100
committerRémy Coutable <remy@rymai.me>2016-12-06 10:23:17 +0100
commit4e249d5baea99a52915025fc2827d01ab2d77c18 (patch)
tree98a0eaa592fdb17657e10a6cd9fe941b17c0253d /app/models/namespace.rb
parent90c0f610e29976608dbfeeb63bc4763982c5dbc3 (diff)
downloadgitlab-ce-25209-improve-length-validators.tar.gz
Use :maximum instead of :within for length validators with a 0..N range25209-improve-length-validators
Signed-off-by: Rémy Coutable <remy@rymai.me>
Diffstat (limited to 'app/models/namespace.rb')
-rw-r--r--app/models/namespace.rb14
1 files changed, 7 insertions, 7 deletions
diff --git a/app/models/namespace.rb b/app/models/namespace.rb
index 891dffac648..7a545f752b6 100644
--- a/app/models/namespace.rb
+++ b/app/models/namespace.rb
@@ -12,17 +12,17 @@ class Namespace < ActiveRecord::Base
validates :owner, presence: true, unless: ->(n) { n.type == "Group" }
validates :name,
- length: { within: 0..255 },
- namespace_name: true,
presence: true,
- uniqueness: true
+ uniqueness: true,
+ length: { maximum: 255 },
+ namespace_name: true
- validates :description, length: { within: 0..255 }
+ validates :description, length: { maximum: 255 }
validates :path,
- length: { within: 1..255 },
- namespace: true,
presence: true,
- uniqueness: { case_sensitive: false }
+ uniqueness: { case_sensitive: false },
+ length: { maximum: 255 },
+ namespace: true
delegate :name, to: :owner, allow_nil: true, prefix: true