diff options
author | Rémy Coutable <remy@rymai.me> | 2016-12-07 10:31:21 +0000 |
---|---|---|
committer | Rémy Coutable <remy@rymai.me> | 2016-12-07 10:31:21 +0000 |
commit | 5186618bb0220383ae4668b7d023bfbbb52c8948 (patch) | |
tree | 50364478658b52192e16fabec2a7326c827b28e4 /app/models/ci/variable.rb | |
parent | 9f8a389ac6c2065e8b4fdf174af18c93ba398d25 (diff) | |
parent | 4e249d5baea99a52915025fc2827d01ab2d77c18 (diff) | |
download | gitlab-ce-5186618bb0220383ae4668b7d023bfbbb52c8948.tar.gz |
Merge branch '25209-improve-length-validators' into 'master'
Use :maximum instead of :within for length validators with a 0..N range
Closes #25209
See merge request !7894
Diffstat (limited to 'app/models/ci/variable.rb')
-rw-r--r-- | app/models/ci/variable.rb | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/app/models/ci/variable.rb b/app/models/ci/variable.rb index 94d9e2b3208..2c8698d8b5d 100644 --- a/app/models/ci/variable.rb +++ b/app/models/ci/variable.rb @@ -4,10 +4,10 @@ module Ci belongs_to :project, foreign_key: :gl_project_id - validates_uniqueness_of :key, scope: :gl_project_id validates :key, presence: true, - length: { within: 0..255 }, + uniqueness: { scope: :gl_project_id }, + length: { maximum: 255 }, format: { with: /\A[a-zA-Z0-9_]+\z/, message: "can contain only letters, digits and '_'." } |