summaryrefslogtreecommitdiff
path: root/app/models/namespace.rb
diff options
context:
space:
mode:
authorDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>2015-03-02 23:06:59 -0800
committerDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>2015-03-02 23:06:59 -0800
commitf438791721360e547f3661a553f491d258013eb8 (patch)
tree6e98d853aec9bca5fec4ebdfcbd0f875308f102b /app/models/namespace.rb
parent2f4656b5c7e2a9b351237432e76a7b928a1684b1 (diff)
downloadgitlab-ce-f438791721360e547f3661a553f491d258013eb8.tar.gz
Fix import check for case sensetive namespaces
Diffstat (limited to 'app/models/namespace.rb')
-rw-r--r--app/models/namespace.rb5
1 files changed, 5 insertions, 0 deletions
diff --git a/app/models/namespace.rb b/app/models/namespace.rb
index 2c7ed376265..35280889a86 100644
--- a/app/models/namespace.rb
+++ b/app/models/namespace.rb
@@ -48,6 +48,11 @@ class Namespace < ActiveRecord::Base
where('lower(path) = :value', value: path.downcase).first
end
+ # Case insensetive search for namespace by path or name
+ def self.find_by_path_or_name(path)
+ find_by("lower(path) = :path OR lower(name) = :path", path: path.downcase)
+ end
+
def self.search(query)
where("name LIKE :query OR path LIKE :query", query: "%#{query}%")
end