al eliminar un sitio eliminar otros datos relacionados

This commit is contained in:
f 2020-11-26 14:40:03 -03:00
parent 9b3eb7a804
commit cc0a9ef3d3
2 changed files with 4 additions and 4 deletions

View file

@ -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

View file

@ -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') },