From 1695cc6771d2bb85ad110cce873a8b9d7e7e6b0d Mon Sep 17 00:00:00 2001 From: f Date: Mon, 28 Sep 2020 19:38:24 -0300 Subject: [PATCH] =?UTF-8?q?empezar=20un=20sitio=20con=20deploy=20local=20n?= =?UTF-8?q?ada=20m=C3=A1s?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/sites_controller.rb | 3 ++- app/services/site_service.rb | 1 + app/views/sites/_form.haml | 2 -- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/app/controllers/sites_controller.rb b/app/controllers/sites_controller.rb index a5d9032e..33d76b7f 100644 --- a/app/controllers/sites_controller.rb +++ b/app/controllers/sites_controller.rb @@ -26,7 +26,8 @@ class SitesController < ApplicationController def new @site = Site.new authorize @site - SiteService.new(site: @site).build_deploys + + @site.deploys.build type: 'DeployLocal' end def create diff --git a/app/services/site_service.rb b/app/services/site_service.rb index 54ac113a..a9b5af4e 100644 --- a/app/services/site_service.rb +++ b/app/services/site_service.rb @@ -35,6 +35,7 @@ SiteService = Struct.new(:site, :usuarie, :params, keyword_init: true) do site end + # Genera los Deploy necesarios para el sitio a menos que ya los tenga. def build_deploys Site::DEPLOYS.map { |deploy| "Deploy#{deploy.to_s.camelcase}" } .each do |deploy| diff --git a/app/views/sites/_form.haml b/app/views/sites/_form.haml index f718ce06..9e617863 100644 --- a/app/views/sites/_form.haml +++ b/app/views/sites/_form.haml @@ -138,8 +138,6 @@ deploy: deploy, site: site - else = f.fields_for :deploys do |deploy| - - next unless deploy.object.is_a? DeployLocal - = deploy.hidden_field :type .form-group