Sha256: df68951a89c111813a7cf0bf50f2008d75e762c305c6bfb8b9b14b2eb8e82d31

Contents?: true

Size: 828 Bytes

Versions: 16

Compression:

Stored size: 828 Bytes

Contents

# Join model between {Mdm::Host} and {Mdm::Tag}.
class Mdm::HostTag < ApplicationRecord
  self.table_name = "hosts_tags"

  #
  # Associations
  #

  # Host with {#tag}.
  #
  # @todo MSP-2723
  belongs_to :host,
             class_name: 'Mdm::Host',
             inverse_of: :hosts_tags

  # Tag on {#host}.
  #
  # @todo MSP-2723
  belongs_to :tag,
             class_name: 'Mdm::Tag',
             inverse_of: :hosts_tags

  #
  # Callbacks
  #

  # @see http://stackoverflow.com/a/11694704
  after_destroy :destroy_orphan_tag
  
  #
  # Instance Methods
  #

  private

  # Destroys {#tag} if it is orphaned
  #
  # @see http://stackoverflow.com/a/11694704
  # @return [void]
  def destroy_orphan_tag
    tag.destroy_if_orphaned
  end

  # switch back to public for load hooks
  public

  Metasploit::Concern.run(self)
end

Version data entries

16 entries across 16 versions & 2 rubygems

Version Path
wg-metasploit_data_models-4.1.4.02 app/models/mdm/host_tag.rb
metasploit_data_models-5.0.6 app/models/mdm/host_tag.rb
metasploit_data_models-5.0.5 app/models/mdm/host_tag.rb
metasploit_data_models-5.0.4 app/models/mdm/host_tag.rb
metasploit_data_models-5.0.3 app/models/mdm/host_tag.rb
metasploit_data_models-5.0.2 app/models/mdm/host_tag.rb
metasploit_data_models-5.0.1 app/models/mdm/host_tag.rb
metasploit_data_models-5.0.0 app/models/mdm/host_tag.rb
metasploit_data_models-4.1.4 app/models/mdm/host_tag.rb
metasploit_data_models-4.1.3 app/models/mdm/host_tag.rb
metasploit_data_models-4.1.2 app/models/mdm/host_tag.rb
metasploit_data_models-4.1.1 app/models/mdm/host_tag.rb
metasploit_data_models-4.1.0 app/models/mdm/host_tag.rb
metasploit_data_models-4.0.2 app/models/mdm/host_tag.rb
metasploit_data_models-4.0.1 app/models/mdm/host_tag.rb
metasploit_data_models-4.0.0 app/models/mdm/host_tag.rb