summaryrefslogtreecommitdiff
path: root/app/models
diff options
context:
space:
mode:
authorDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>2015-08-24 12:53:39 +0000
committerDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>2015-08-24 12:53:39 +0000
commitadd099b024cc4155a5be494fdb9ae339fd073a14 (patch)
tree0ee484fe1bb0dbdae4333e30ad7c3c36251c1bcf /app/models
parent24b282aeeaf5ba41c6b73100051eb48428787770 (diff)
parent56527b63e8a09e0fe4967eabf08638d853e6b2b5 (diff)
downloadgitlab-ce-add099b024cc4155a5be494fdb9ae339fd073a14.tar.gz
Merge branch 'milestone_search' into 'master'
Ability to search milestones https://dev.gitlab.org/gitlab/gitlabhq/issues/2473 See merge request !1158
Diffstat (limited to 'app/models')
-rw-r--r--app/models/milestone.rb9
1 files changed, 8 insertions, 1 deletions
diff --git a/app/models/milestone.rb b/app/models/milestone.rb
index d28f3c8d3f9..c6aff6f709f 100644
--- a/app/models/milestone.rb
+++ b/app/models/milestone.rb
@@ -47,6 +47,13 @@ class Milestone < ActiveRecord::Base
state :active
end
+ class << self
+ def search(query)
+ query = "%#{query}%"
+ where("title like ? or description like ?", query, query)
+ end
+ end
+
def expired?
if due_date
due_date.past?
@@ -54,7 +61,7 @@ class Milestone < ActiveRecord::Base
false
end
end
-
+
def open_items_count
self.issues.opened.count + self.merge_requests.opened.count
end