From cc0a9ef3d3c19f794d1a40ce60049de4f19c46e6 Mon Sep 17 00:00:00 2001 From: f Date: Thu, 26 Nov 2020 14:40:03 -0300 Subject: [PATCH] al eliminar un sitio eliminar otros datos relacionados --- app/models/deploy.rb | 2 +- app/models/site.rb | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/app/models/deploy.rb b/app/models/deploy.rb index 98e6d0a1..907739f2 100644 --- a/app/models/deploy.rb +++ b/app/models/deploy.rb @@ -9,7 +9,7 @@ require 'open3' # :attributes`. class Deploy < ApplicationRecord belongs_to :site - has_many :build_stats + has_many :build_stats, dependent: :destroy def deploy raise NotImplementedError diff --git a/app/models/site.rb b/app/models/site.rb index b053a6fc..2d6e315c 100644 --- a/app/models/site.rb +++ b/app/models/site.rb @@ -36,10 +36,10 @@ class Site < ApplicationRecord belongs_to :design belongs_to :licencia - has_many :log_entries - has_many :deploys + has_many :log_entries, dependent: :destroy + has_many :deploys, dependent: :destroy has_many :build_stats, through: :deploys - has_many :roles + has_many :roles, dependent: :destroy has_many :usuaries, -> { where('roles.rol = ?', 'usuarie') }, through: :roles has_many :invitades, -> { where('roles.rol = ?', 'invitade') },