Sha256: 8555201a4e5112f63f269adb1cfcd30a050937fdfff5f9baec2ae4bbd60e7581

Contents?: true

Size: 1.42 KB

Versions: 23

Compression:

Stored size: 1.42 KB

Contents

module Naf
  class HistoricalJobAffinityTab < ::Naf::ByHistoricalJobId
    # Protect from mass-assignment issue
    attr_accessible :affinity_id,
                    :historical_job_id,
                    :historical_job,
                    :affinity_parameter

    #---------------------
    # *** Associations ***
    #+++++++++++++++++++++

    belongs_to :affinity,
      class_name: "::Naf::Affinity"

    #--------------------
    # *** Validations ***
    #++++++++++++++++++++

    validates :affinity_id, presence: true,
                            uniqueness: {
                              scope: :historical_job_id,
                              message: "has already been taken for this job"
                            }

    #--------------------
    # *** Delegations ***
    #++++++++++++++++++++

    delegate :affinity_name,
             :affinity_classification_name,
             :affinity_short_name, to: :affinity

    #------------------
    # *** Partition ***
    #++++++++++++++++++

    partitioned do |partition|
      partition.foreign_key :affinity_id, ::Naf::Affinity.table_name
    end

    #-------------------------
    # *** Instance Methods ***
    #+++++++++++++++++++++++++

    def job
      ::Naf::HistoricalJob.
        from_partition(id).
        where(id: historical_job_id).first
    end

    def script_type_name
      job.script_type_name
    end

    def command
      job.command
    end

  end
end

Version data entries

23 entries across 23 versions & 1 rubygems

Version Path
naf-2.1.13 app/models/naf/historical_job_affinity_tab.rb
naf-2.1.12 app/models/naf/historical_job_affinity_tab.rb
naf-2.1.11 app/models/naf/historical_job_affinity_tab.rb
naf-2.1.10 app/models/naf/historical_job_affinity_tab.rb
naf-2.1.9 app/models/naf/historical_job_affinity_tab.rb
naf-2.1.8 app/models/naf/historical_job_affinity_tab.rb
naf-2.1.6 app/models/naf/historical_job_affinity_tab.rb
naf-2.1.5 app/models/naf/historical_job_affinity_tab.rb
naf-2.1.4 app/models/naf/historical_job_affinity_tab.rb
naf-2.1.3 app/models/naf/historical_job_affinity_tab.rb
naf-2.1.2 app/models/naf/historical_job_affinity_tab.rb
naf-2.1.1 app/models/naf/historical_job_affinity_tab.rb
naf-2.1.0 app/models/naf/historical_job_affinity_tab.rb
naf-2.0.4 app/models/naf/historical_job_affinity_tab.rb
naf-2.0.3 app/models/naf/historical_job_affinity_tab.rb
naf-2.0.2 app/models/naf/historical_job_affinity_tab.rb
naf-2.0.1 app/models/naf/historical_job_affinity_tab.rb
naf-2.0.0 app/models/naf/historical_job_affinity_tab.rb
naf-1.1.4 app/models/naf/historical_job_affinity_tab.rb
naf-1.1.3 app/models/naf/historical_job_affinity_tab.rb