summaryrefslogtreecommitdiff
path: root/app/models/label_priority.rb
diff options
context:
space:
mode:
authorDouglas Barbosa Alexandre <dbalexandre@gmail.com>2016-10-14 16:12:07 -0300
committerDouglas Barbosa Alexandre <dbalexandre@gmail.com>2016-10-19 14:58:27 -0200
commit297892011330ecdd2fa7cbe47fbc6fd4f3b62171 (patch)
tree6cbbb21eae4f3fa3d28b33599a0ea87fbf0f34ec /app/models/label_priority.rb
parentde9d3915d249a59e65226f6dd2ebe1f50a47306e (diff)
downloadgitlab-ce-297892011330ecdd2fa7cbe47fbc6fd4f3b62171.tar.gz
Add LabelPriority model
Diffstat (limited to 'app/models/label_priority.rb')
-rw-r--r--app/models/label_priority.rb8
1 files changed, 8 insertions, 0 deletions
diff --git a/app/models/label_priority.rb b/app/models/label_priority.rb
new file mode 100644
index 00000000000..5b85e0b6533
--- /dev/null
+++ b/app/models/label_priority.rb
@@ -0,0 +1,8 @@
+class LabelPriority < ActiveRecord::Base
+ belongs_to :project
+ belongs_to :label
+
+ validates :project, :label, :priority, presence: true
+ validates :label_id, uniqueness: { scope: :project_id }
+ validates :priority, numericality: { only_integer: true, greater_than_or_equal_to: 0 }
+end