diff --git a/app/controllers/sites_controller.rb b/app/controllers/sites_controller.rb index 598c7755..f2bdf648 100644 --- a/app/controllers/sites_controller.rb +++ b/app/controllers/sites_controller.rb @@ -113,6 +113,6 @@ class SitesController < ApplicationController def site_params params.require(:site) .permit(:name, :design_id, :licencia_id, :description, :title, - deploys_attributes: %i[type id _destroy]) + deploys_attributes: %i[type id _destroy hostname]) end end diff --git a/app/models/site.rb b/app/models/site.rb index 9d734247..c559fb0e 100644 --- a/app/models/site.rb +++ b/app/models/site.rb @@ -7,7 +7,7 @@ class Site < ApplicationRecord # TODO: Hacer que los diferentes tipos de deploy se auto registren # @see app/services/site_service.rb - DEPLOYS = %i[local www zip].freeze + DEPLOYS = %i[local www zip alternative_domain].freeze validates :name, uniqueness: true, hostname: { allow_root_label: true @@ -335,7 +335,9 @@ class Site < ApplicationRecord def deploy_local_presence # Usamos size porque queremos saber la cantidad de deploys sin # guardar tambiƩn - return if deploys.size.positive? && deploys.map(&:type).include?('DeployLocal') + if deploys.size.positive? && deploys.map(&:type).include?('DeployLocal') + return + end errors.add(:deploys, I18n.t('activerecord.errors.models.site.attributes.deploys.deploy_local_presence')) end