Add search method to Note class

Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
This commit is contained in:
Dmitriy Zaporozhets 2014-08-26 23:39:37 +03:00
parent 9a4ef7e7eb
commit 5d9a5c02d8
No known key found for this signature in database
GPG Key ID: 627C5F589F467F17
1 changed files with 4 additions and 0 deletions

View File

@ -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