diff options
author | Douwe Maan <douwe@gitlab.com> | 2015-07-24 09:29:58 +0000 |
---|---|---|
committer | Douwe Maan <douwe@gitlab.com> | 2015-07-24 09:29:58 +0000 |
commit | 0c1d912559fa1cd6b209af609ee192a5cd10c455 (patch) | |
tree | a314504cb9ca6a1d9d92a0a70b67b042d3e2ea94 /app/models | |
parent | 7e262ebf157f2af4658485aae7073d315648cfa7 (diff) | |
parent | 5ce6d18681ee7b74ba0c443672224dd580bd34b0 (diff) | |
download | gitlab-ce-0c1d912559fa1cd6b209af609ee192a5cd10c455.tar.gz |
Merge branch 'rs-issue-2012' into 'master'
Make username parameter for Users#show case-insensitive
Closes #2012
See merge request !996
Diffstat (limited to 'app/models')
-rw-r--r-- | app/models/user.rb | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/app/models/user.rb b/app/models/user.rb index fb330ff7185..4a10520b209 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -274,6 +274,10 @@ class User < ActiveRecord::Base value: login.to_s.downcase).first end + def find_by_username!(username) + find_by!('lower(username) = ?', username.downcase) + end + def by_username_or_id(name_or_id) where('users.username = ? OR users.id = ?', name_or_id.to_s, name_or_id.to_i).first end |