Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDouwe Maan <douwe@selenight.nl>2017-11-24 13:45:19 +0300
committerDouwe Maan <douwe@selenight.nl>2017-11-24 19:28:50 +0300
commitaedd2cfa5b82c01f82ec26b64880fce2a07fe942 (patch)
treee8c2094d81b86a471fdbb9de4f4a279ec0a0ef75 /app/models/note.rb
parentb355ebc4c9b38320366d7640ecf51da23fbb7ea1 (diff)
Use Gitlab::SQL::Pattern where appropriate
Diffstat (limited to 'app/models/note.rb')
-rw-r--r--app/models/note.rb5
1 files changed, 5 insertions, 0 deletions
diff --git a/app/models/note.rb b/app/models/note.rb
index 50c9caf8529..d2aa8392229 100644
--- a/app/models/note.rb
+++ b/app/models/note.rb
@@ -14,6 +14,7 @@ class Note < ActiveRecord::Base
include ResolvableNote
include IgnorableColumn
include Editable
+ include Gitlab::SQL::Pattern
module SpecialRole
FIRST_TIME_CONTRIBUTOR = :first_time_contributor
@@ -167,6 +168,10 @@ class Note < ActiveRecord::Base
def has_special_role?(role, note)
note.special_role == role
end
+
+ def search(query)
+ where(arel_table[:note].matches(to_pattern(query)))
+ end
end
def cross_reference?