Commit 4b737a20 authored by allison.browne's avatar allison.browne

Change queries from using count to limit

parent ea5991bc
......@@ -9,7 +9,7 @@ class Admin::Serverless::DomainsController < Admin::ApplicationController
end
def create
if PagesDomain.instance_serverless.count > 0
if PagesDomain.instance_serverless.exists?
return redirect_to admin_serverless_domains_path, notice: _('An instance-level serverless domain already exists.')
end
......@@ -31,7 +31,7 @@ class Admin::Serverless::DomainsController < Admin::ApplicationController
end
def destroy
if domain.serverless_domain_clusters.count > 0
if domain.serverless_domain_clusters.exists?
return redirect_to admin_serverless_domains_path,
status: :conflict,
notice: _('Domain cannot be deleted while associated to one or more clusters.')
......
......@@ -206,11 +206,11 @@ module API
conflict!('Email has already been taken') if params[:email] &&
User.by_any_email(params[:email].downcase)
.where.not(id: user.id).count > 0
.where.not(id: user.id).exists?
conflict!('Username has already been taken') if params[:username] &&
User.by_username(params[:username])
.where.not(id: user.id).count > 0
.where.not(id: user.id).exists?
user_params = declared_params(include_missing: false)
......
......@@ -188,7 +188,7 @@ module Gitlab
end
def apply_labels(issuable, raw)
return unless raw.labels.count > 0
return unless raw.labels.exists?
label_ids = raw.labels
.map { |attrs| @labels[attrs.name] }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment