diff options
author | Shinya Maeda <shinya@gitlab.com> | 2017-07-03 16:59:57 +0900 |
---|---|---|
committer | Shinya Maeda <shinya@gitlab.com> | 2017-07-05 18:38:35 +0900 |
commit | 621f9307ff261f00c67b04210210a14cd7aac081 (patch) | |
tree | 630704afbdc89115ed115d403784297ddaeb17d3 /app | |
parent | ff7529b39dc36be188f7039d6cf96cb60630dca5 (diff) | |
download | gitlab-ce-621f9307ff261f00c67b04210210a14cd7aac081.tar.gz |
Implement uniqueness_of_in_memory_validator
Diffstat (limited to 'app')
-rw-r--r-- | app/models/ci/pipeline_schedule.rb | 5 |
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 |