Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDouglas Barbosa Alexandre <dbalexandre@gmail.com>2016-08-03 20:21:22 +0300
committerDouglas Barbosa Alexandre <dbalexandre@gmail.com>2016-08-17 18:58:58 +0300
commitc14ac835756d1d0f4d0f8279759e2b7f75364447 (patch)
tree925000dd60d64676eb76b8d4830ee7a9001a9a4f /app/models/list.rb
parentc08a14c3c20de35018a36f89dec0b10c99a4fd86 (diff)
Ensure that we have only one list per label per board
Diffstat (limited to 'app/models/list.rb')
-rw-r--r--app/models/list.rb1
1 files changed, 1 insertions, 0 deletions
diff --git a/app/models/list.rb b/app/models/list.rb
index f2a59d18c46..6f639a51150 100644
--- a/app/models/list.rb
+++ b/app/models/list.rb
@@ -6,6 +6,7 @@ class List < ActiveRecord::Base
validates :board, :list_type, presence: true
validates :label, :position, presence: true, if: :label?
+ validates :label_id, uniqueness: { scope: :board_id }, if: :label?
validates :position, numericality: { only_integer: true, greater_than_or_equal_to: 0 }, if: :label?
delegate :name, to: :label, allow_nil: true, prefix: true