From fefa6f185ba5a2710fae711fbf6802c7bb3cb496 Mon Sep 17 00:00:00 2001 From: skovic Date: Fri, 20 Jul 2018 14:50:56 -0400 Subject: [PATCH] Fix rails rubocop warnings --- app/models/ext_management_system.rb | 2 +- app/models/physical_server.rb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/app/models/ext_management_system.rb b/app/models/ext_management_system.rb index 53713330dc6..746a9cf5a2f 100644 --- a/app/models/ext_management_system.rb +++ b/app/models/ext_management_system.rb @@ -49,7 +49,7 @@ def self.api_allowed_attributes has_many :hardwares, :through => :vms_and_templates has_many :networks, :through => :hardwares has_many :disks, :through => :hardwares - has_many :physical_servers, :foreign_key => :ems_id, :inverse_of => :ext_management_system + has_many :physical_servers, :foreign_key => :ems_id, :inverse_of => :ext_management_system, :dependent => :destroy has_many :storages, -> { distinct }, :through => :hosts has_many :ems_events, -> { order("timestamp") }, :class_name => "EmsEvent", :foreign_key => "ems_id", diff --git a/app/models/physical_server.rb b/app/models/physical_server.rb index ce3dcfa5ffe..17edc56683d 100644 --- a/app/models/physical_server.rb +++ b/app/models/physical_server.rb @@ -27,7 +27,7 @@ class PhysicalServer < ApplicationRecord has_one :host, :inverse_of => :physical_server has_one :asset_detail, :as => :resource, :dependent => :destroy has_many :guest_devices, :through => :hardware - has_many :miq_alert_statuses, :as => :resource, :dependent => :destroy + has_many :miq_alert_statuses, :as => :resource, :dependent => :destroy, :inverse_of => :physical_server scope :with_hosts, -> { where("physical_servers.id in (select hosts.physical_server_id from hosts)") }