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/namespace.rb
parentb355ebc4c9b38320366d7640ecf51da23fbb7ea1 (diff)
Use Gitlab::SQL::Pattern where appropriate
Diffstat (limited to 'app/models/namespace.rb')
-rw-r--r--app/models/namespace.rb3
1 files changed, 2 insertions, 1 deletions
diff --git a/app/models/namespace.rb b/app/models/namespace.rb
index 4d401e7ba18..15bc7032a43 100644
--- a/app/models/namespace.rb
+++ b/app/models/namespace.rb
@@ -9,6 +9,7 @@ class Namespace < ActiveRecord::Base
include Routable
include AfterCommitQueue
include Storage::LegacyNamespace
+ include Gitlab::SQL::Pattern
# Prevent users from creating unreasonably deep level of nesting.
# The number 20 was taken based on maximum nesting level of
@@ -87,7 +88,7 @@ class Namespace < ActiveRecord::Base
# Returns an ActiveRecord::Relation
def search(query)
t = arel_table
- pattern = "%#{query}%"
+ pattern = to_pattern(query)
where(t[:name].matches(pattern).or(t[:path].matches(pattern)))
end