diff options
author | Rémy Coutable <remy@rymai.me> | 2016-12-02 15:54:57 +0300 |
---|---|---|
committer | Rémy Coutable <remy@rymai.me> | 2016-12-06 12:23:17 +0300 |
commit | 4e249d5baea99a52915025fc2827d01ab2d77c18 (patch) | |
tree | 98a0eaa592fdb17657e10a6cd9fe941b17c0253d /app/models/namespace.rb | |
parent | 90c0f610e29976608dbfeeb63bc4763982c5dbc3 (diff) |
Use :maximum instead of :within for length validators with a 0..N range
Signed-off-by: Rémy Coutable <remy@rymai.me>
Diffstat (limited to 'app/models/namespace.rb')
-rw-r--r-- | app/models/namespace.rb | 14 |
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 |