From 0fe1c9b64869703b8d803d56955422dceabf6e37 Mon Sep 17 00:00:00 2001
From: Tim Bishop <tim@bishnet.net>
Date: Fri, 30 Jan 2015 23:49:01 +0000
Subject: [PATCH] Fix group search to check path as well as name.

The API documentation says:

"You can search for groups by name or path with: /groups?search=Rails"

But you can't because the search query only checks the name, not
the path. This fixes that.
---
 app/models/group.rb | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/app/models/group.rb b/app/models/group.rb
index e098dfb3cdf..042b79a7850 100644
--- a/app/models/group.rb
+++ b/app/models/group.rb
@@ -91,7 +91,7 @@ class Group < Namespace
 
   class << self
     def search(query)
-      where("LOWER(namespaces.name) LIKE :query", query: "%#{query.downcase}%")
+      where("LOWER(namespaces.name) LIKE :query or LOWER(namespaces.path) LIKE :query", query: "%#{query.downcase}%")
     end
 
     def sort(method)
-- 
GitLab