Sha256: 6ea3b10773c72abd3a759b3820be18922bbffdab4cbaeba4c1afa55f3f8bb5cd

Contents?: true

Size: 751 Bytes

Versions: 4

Compression:

Stored size: 751 Bytes

Contents

module ForemanOpenscap
  module HostgroupExtensions
    extend ActiveSupport::Concern

    included do
      has_one :asset, :as => :assetable, :class_name => "::ForemanOpenscap::Asset", dependent: :destroy
      has_many :asset_policies, :through => :asset, :class_name => "::ForemanOpenscap::AssetPolicy"
      has_many :policies, :through => :asset_policies, :class_name => "::ForemanOpenscap::Policy"
    end

    unless defined?(Katello::System)
      private

      def inherited_ancestry_attribute(attribute)
        if ancestry.present?
          self[attribute] || self.class.sort_by_ancestry(ancestors.where("#{attribute} is not NULL")).last.try(attribute)
        else
          self.send(attribute)
        end
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
foreman_openscap-0.6.3 app/models/concerns/foreman_openscap/hostgroup_extensions.rb
foreman_openscap-0.6.2 app/models/concerns/foreman_openscap/hostgroup_extensions.rb
foreman_openscap-0.6.1 app/models/concerns/foreman_openscap/hostgroup_extensions.rb
foreman_openscap-0.6.0 app/models/concerns/foreman_openscap/hostgroup_extensions.rb