Skip to content

Commit

Permalink
Merge pull request #16833 from bdunne/asset_detailsssssssssssssssssss…
Browse files Browse the repository at this point in the history
…ssss

Singularize plural model
  • Loading branch information
Fryguy authored Feb 16, 2018
2 parents dfc9c90 + e7fbe82 commit a78bd64
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 13 deletions.
7 changes: 7 additions & 0 deletions app/models/asset_detail.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
class AssetDetail < ApplicationRecord
include NewWithTypeStiMixin

acts_as_miq_taggable

belongs_to :resource, :polymorphic => true
end
7 changes: 0 additions & 7 deletions app/models/asset_details.rb

This file was deleted.

6 changes: 3 additions & 3 deletions app/models/ems_refresh/save_inventory_physical_infra.rb
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ def save_physical_servers_inventory(ems, hashes, target = nil)
[]
end

child_keys = [:computer_system, :asset_details, :hosts]
child_keys = [:computer_system, :asset_detail, :hosts]
save_inventory_multi(ems.physical_servers, hashes, deletes, [:ems_ref], child_keys)
store_ids_for_new_records(ems.physical_servers, hashes, :ems_ref)
end
Expand All @@ -69,8 +69,8 @@ def save_customization_scripts_inventory(ems, hashes, target = nil)
#
# Saves asset details information of a resource
#
def save_asset_details_inventory(parent, hash)
def save_asset_detail_inventory(parent, hash)
return if hash.nil?
save_inventory_single(:asset_details, parent, hash)
save_inventory_single(:asset_detail, parent, hash)
end
end
2 changes: 1 addition & 1 deletion app/models/physical_server.rb
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ class PhysicalServer < ApplicationRecord
has_one :computer_system, :as => :managed_entity, :dependent => :destroy
has_one :hardware, :through => :computer_system
has_one :host, :inverse_of => :physical_server
has_one :asset_details, :as => :resource, :dependent => :destroy
has_one :asset_detail, :as => :resource, :dependent => :destroy

scope :with_hosts, -> { where("physical_servers.id in (select hosts.physical_server_id from hosts)") }

Expand Down
3 changes: 1 addition & 2 deletions spec/factories/asset_details.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
FactoryGirl.define do
factory :asset_details do
end
factory :asset_detail
end

0 comments on commit a78bd64

Please sign in to comment.