diff options
author | Douwe Maan <douwe@gitlab.com> | 2015-02-13 12:39:11 +0100 |
---|---|---|
committer | Douwe Maan <douwe@gitlab.com> | 2015-02-13 12:39:11 +0100 |
commit | 161d15541a65ba167830f9a9bf5d181d0c5f4d77 (patch) | |
tree | d1dc93fd8fedb71219e54d0da1d70f68e1ca9f0d /app/models/namespace.rb | |
parent | 529188e4788991961796b1b6131389072ee61efb (diff) | |
download | gitlab-ce-161d15541a65ba167830f9a9bf5d181d0c5f4d77.tar.gz |
Prevent autogenerated OAuth username to clash with existing namespace.
Diffstat (limited to 'app/models/namespace.rb')
-rw-r--r-- | app/models/namespace.rb | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/app/models/namespace.rb b/app/models/namespace.rb index ba0b2b71cf9..2c7ed376265 100644 --- a/app/models/namespace.rb +++ b/app/models/namespace.rb @@ -44,6 +44,10 @@ class Namespace < ActiveRecord::Base scope :root, -> { where('type IS NULL') } + def self.by_path(path) + where('lower(path) = :value', value: path.downcase).first + end + def self.search(query) where("name LIKE :query OR path LIKE :query", query: "%#{query}%") end |