Commit 5d9a5c02 authored by Dmitriy Zaporozhets's avatar Dmitriy Zaporozhets

Add search method to Note class

Signed-off-by: default avatarDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
parent 9a4ef7e7
...@@ -146,6 +146,10 @@ class Note < ActiveRecord::Base ...@@ -146,6 +146,10 @@ class Note < ActiveRecord::Base
def cross_reference_exists?(noteable, mentioner) def cross_reference_exists?(noteable, mentioner)
where(noteable_id: noteable.id, system: true, note: "_mentioned in #{mentioner.gfm_reference}_").any? where(noteable_id: noteable.id, system: true, note: "_mentioned in #{mentioner.gfm_reference}_").any?
end end
def search(query)
where("note like :query", query: "%#{query}%")
end
end end
def commit_author def commit_author
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment