Add exists to users routes and fix endpoint.

This commit is contained in:
Bryce Johnson 2016-10-11 18:28:00 +02:00
parent 5439bd9f95
commit 568a405ce4
2 changed files with 2 additions and 1 deletions

View File

@ -86,7 +86,7 @@ class UsersController < ApplicationController
end
def exists
render json: { exists: !Namespace.where(name: params[:username]).nil? }
render json: { exists: Namespace.where(path: params[:username].downcase).any? }
end
private

View File

@ -33,5 +33,6 @@ scope(path: 'u/:username',
get :projects
get :contributed, as: :contributed_projects
get :snippets
get :exists
get '/', to: redirect('/%{username}')
end