Form refactoring (#142)

This commit is contained in:
Riccardo Graziosi
2022-07-22 16:50:36 +02:00
committed by GitHub
parent d078e659c6
commit 9592ac3d1d
22 changed files with 557 additions and 1060 deletions

View File

@@ -47,6 +47,18 @@ class TenantsController < ApplicationController
end
end
# Given a new_subdomain
# Returns true if it is available, false otherwise
def is_available
subdomain = params[:new_subdomain]
return unless subdomain.present?
return if RESERVED_SUBDOMAINS.include?(subdomain)
return if Tenant.exists?(subdomain: subdomain)
render json: { is_available: 'true' }
end
private
def tenant_create_params