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:
authorDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>2014-07-30 16:15:39 +0400
committerDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>2014-07-30 16:15:39 +0400
commit593df8e69a81a3ab0a4755db74dc282c00e02ef5 (patch)
treecdbec00afa3289a9fe4065a8c7ba56e5c82a365f /app/models/label.rb
parentcc331684593143cba773b0160222865eeb86b134 (diff)
Improve labels
* allow developers to manage labels * add ability to remove label Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
Diffstat (limited to 'app/models/label.rb')
-rw-r--r--app/models/label.rb5
1 files changed, 5 insertions, 0 deletions
diff --git a/app/models/label.rb b/app/models/label.rb
index ea1daa6a204..5d6e5e91a0c 100644
--- a/app/models/label.rb
+++ b/app/models/label.rb
@@ -1,6 +1,7 @@
class Label < ActiveRecord::Base
belongs_to :project
has_many :label_links, dependent: :destroy
+ has_many :issues, through: :label_links, source: :target, source_type: 'Issue'
validates :color, format: { with: /\A\#[0-9A-Fa-f]{6}+\Z/ }, allow_blank: true
validates :project, presence: true
@@ -11,4 +12,8 @@ class Label < ActiveRecord::Base
def name
title
end
+
+ def open_issues_count
+ issues.opened.count
+ end
end