From 85f1cd2bdcfef93f8e843c735742150bfa199856 Mon Sep 17 00:00:00 2001 From: Kamil Trzcinski Date: Thu, 6 Aug 2015 16:45:02 +0200 Subject: Require the variable key to be set and unique --- app/models/variable.rb | 3 +++ 1 file changed, 3 insertions(+) (limited to 'app/models') diff --git a/app/models/variable.rb b/app/models/variable.rb index b40fcbf..559b9f2 100644 --- a/app/models/variable.rb +++ b/app/models/variable.rb @@ -14,5 +14,8 @@ class Variable < ActiveRecord::Base belongs_to :project + validates_presence_of :key + validates_uniqueness_of :key + attr_encrypted :value, mode: :per_attribute_iv_and_salt, key: GitlabCi::Application.secrets.db_key_base end -- cgit v1.2.1