summaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
authorShinya Maeda <shinya@gitlab.com>2017-07-03 16:59:57 +0900
committerShinya Maeda <shinya@gitlab.com>2017-07-05 18:38:35 +0900
commit621f9307ff261f00c67b04210210a14cd7aac081 (patch)
tree630704afbdc89115ed115d403784297ddaeb17d3 /app
parentff7529b39dc36be188f7039d6cf96cb60630dca5 (diff)
downloadgitlab-ce-621f9307ff261f00c67b04210210a14cd7aac081.tar.gz
Implement uniqueness_of_in_memory_validator
Diffstat (limited to 'app')
-rw-r--r--app/models/ci/pipeline_schedule.rb5
1 files changed, 5 insertions, 0 deletions
diff --git a/app/models/ci/pipeline_schedule.rb b/app/models/ci/pipeline_schedule.rb
index df9df45edb0..ad9f8b89924 100644
--- a/app/models/ci/pipeline_schedule.rb
+++ b/app/models/ci/pipeline_schedule.rb
@@ -15,6 +15,11 @@ module Ci
validates :cron_timezone, cron_timezone: true, presence: { unless: :importing? }
validates :ref, presence: { unless: :importing? }
validates :description, presence: true
+ validates :variables, uniqueness_of_in_memory: {
+ :collection => :variables,
+ :attrs => [:pipeline_schedule_id, :key],
+ :message => ['variables.key', 'keys are duplicated']
+ }
before_save :set_next_run_at