From 5d9a5c02d83c2aa9fed66c045eb88762679fb60e Mon Sep 17 00:00:00 2001 From: Dmitriy Zaporozhets Date: Tue, 26 Aug 2014 23:39:37 +0300 Subject: [PATCH] Add search method to Note class Signed-off-by: Dmitriy Zaporozhets --- app/models/note.rb | 4 ++++ 1 file changed, 4 insertions(+) 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 -- GitLab