summaryrefslogtreecommitdiff
path: root/app/models/note.rb
diff options
context:
space:
mode:
authorDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>2014-08-26 23:39:37 +0300
committerDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>2014-08-26 23:39:37 +0300
commit5d9a5c02d83c2aa9fed66c045eb88762679fb60e (patch)
tree5a35b09f5e53634e0c30dc1e1320bc90fda79fcf /app/models/note.rb
parent9a4ef7e7eb1fe73938578d82c2662913e3d51ad6 (diff)
downloadgitlab-ce-5d9a5c02d83c2aa9fed66c045eb88762679fb60e.tar.gz
Add search method to Note class
Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
Diffstat (limited to 'app/models/note.rb')
-rw-r--r--app/models/note.rb4
1 files changed, 4 insertions, 0 deletions
diff --git a/app/models/note.rb b/app/models/note.rb
index 7ff6444cc9b..01f72b95c48 100644
--- a/app/models/note.rb
+++ b/app/models/note.rb
@@ -146,6 +146,10 @@ class Note < ActiveRecord::Base
def cross_reference_exists?(noteable, mentioner)
where(noteable_id: noteable.id, system: true, note: "_mentioned in #{mentioner.gfm_reference}_").any?
end
+
+ def search(query)
+ where("note like :query", query: "%#{query}%")
+ end
end
def commit_author