Sha256: 7a44fc8c5d1b98906dd5519c06a359b91f3bbc41fd3ff4d5f8195413359f3d96

Contents?: true

Size: 1.06 KB

Versions: 23

Compression:

Stored size: 1.06 KB

Contents

module Naf
  class AffinityClassification < NafBase
    # Protect from mass-assignment issue
    attr_accessible :affinity_classification_name

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

    has_many :affinities, dependent: :destroy

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

    validates :affinity_classification_name, presence: true,
                                             length: { minimum: 1 }

    #-------------------------
    # *** Class Methods ***
    #+++++++++++++++++++++++++

    def self.purpose
      @@purpose ||= find_by_affinity_classification_name('purpose')
    end

    def self.location
      @@location ||= find_by_affinity_classification_name('location')
    end

    def self.application
      @@application ||= find_by_affinity_classification_name('application')
    end

    def self.weight
      @@weight ||= find_by_affinity_classification_name('weight')
    end

    def self.machine
      @@machine ||= find_by_affinity_classification_name('machine')
    end

  end
end

Version data entries

23 entries across 23 versions & 1 rubygems

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