Method: Mdm::Tag#destroy_if_orphaned

Defined in:
app/models/mdm/tag.rb

#destroy_if_orphanedvoid

This method returns an undefined value.

Destroy this tag if it has no #hosts_tags



101
102
103
104
105
106
107
108
# File 'app/models/mdm/tag.rb', line 101

def destroy_if_orphaned
  self.class.transaction do
    # call `.count` to avoid serialization of any Mdm::HostTag that may exist
    if hosts_tags.count == 0
      destroy
    end
  end
end