Sha256: 5695a1fb8be83d54897385c1039b2136e6a47222f003ab91d864fb27e324e0dc

Contents?: true

Size: 857 Bytes

Versions: 5

Compression:

Stored size: 857 Bytes

Contents

class Mdm::HostTag < ActiveRecord::Base
  self.table_name = "hosts_tags"

  #
  # Associations
  #

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

  # @!attribute tag
  #   Tag on {#host}.
  #
  #   @todo MSP-2723
  #   @return [Mdm::Tag]
  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

  public

  ActiveSupport.run_load_hooks(:mdm_host_tag, self)
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
metasploit_data_models-0.17.2-java app/models/mdm/host_tag.rb
metasploit_data_models-0.17.2 app/models/mdm/host_tag.rb
metasploit_data_models-0.17.2.pre.metasploit.pre.data.pre.models.pre.search app/models/mdm/host_tag.rb
metasploit_data_models-0.17.1-java app/models/mdm/host_tag.rb
metasploit_data_models-0.17.1 app/models/mdm/host_tag.rb