diff --git a/app/models/deploy.rb b/app/models/deploy.rb index 0da07be9..37790eb3 100644 --- a/app/models/deploy.rb +++ b/app/models/deploy.rb @@ -9,6 +9,8 @@ require 'open3' class Deploy < ApplicationRecord # Un sitio puede tener muchas formas de publicarse. belongs_to :site + # Puede tener muchos access logs a través del hostname + has_many :access_logs, primary_key: 'hostname', foreign_key: 'host' # Siempre generar el hostname after_initialize :default_hostname! diff --git a/app/models/site.rb b/app/models/site.rb index c9357657..d0c420f1 100644 --- a/app/models/site.rb +++ b/app/models/site.rb @@ -39,6 +39,7 @@ class Site < ApplicationRecord has_many :log_entries, dependent: :destroy has_many :deploys, dependent: :destroy + has_many :access_logs, through: :deploys has_many :build_stats, through: :deploys has_many :roles, dependent: :destroy has_many :usuaries, -> { where('roles.rol = ?', 'usuarie') },