Sha256: 0385983ef83fb5c287301f04c64c384034ab34e9d2239300bf911ac3fe422a97

Contents?: true

Size: 829 Bytes

Versions: 42

Compression:

Stored size: 829 Bytes

Contents

# Join model between {Mdm::Host} and {Mdm::Tag}.
class Mdm::HostTag < ActiveRecord::Base
  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

42 entries across 42 versions & 1 rubygems

Version Path
metasploit_data_models-3.0.10 app/models/mdm/host_tag.rb
metasploit_data_models-3.0.9 app/models/mdm/host_tag.rb
metasploit_data_models-3.0.8 app/models/mdm/host_tag.rb
metasploit_data_models-3.0.7 app/models/mdm/host_tag.rb
metasploit_data_models-3.0.6 app/models/mdm/host_tag.rb
metasploit_data_models-3.0.5 app/models/mdm/host_tag.rb
metasploit_data_models-2.0.17 app/models/mdm/host_tag.rb
metasploit_data_models-3.0.4 app/models/mdm/host_tag.rb
metasploit_data_models-3.0.2 app/models/mdm/host_tag.rb
metasploit_data_models-3.0.1 app/models/mdm/host_tag.rb
metasploit_data_models-3.0.0 app/models/mdm/host_tag.rb
metasploit_data_models-2.0.16 app/models/mdm/host_tag.rb
metasploit_data_models-2.0.15 app/models/mdm/host_tag.rb
metasploit_data_models-2.0.14 app/models/mdm/host_tag.rb
metasploit_data_models-2.0.13 app/models/mdm/host_tag.rb
metasploit_data_models-2.0.12 app/models/mdm/host_tag.rb
metasploit_data_models-2.0.11 app/models/mdm/host_tag.rb
metasploit_data_models-2.0.10 app/models/mdm/host_tag.rb
metasploit_data_models-2.0.9 app/models/mdm/host_tag.rb
metasploit_data_models-2.0.8 app/models/mdm/host_tag.rb