Sha256: c9c2e68a1b34727cb9e32622ec0c144d80669581e7bc1270d0951c3d5512cca7

Contents?: true

Size: 668 Bytes

Versions: 2

Compression:

Stored size: 668 Bytes

Contents

# frozen_string_literals: true

module Jobshop
  class Inspection::Criterion < ApplicationRecord
    self.primary_keys = %i[ organization_id report_id criterion_id criterion_type ]

    after_initialize { self.criterion_id ||= SecureRandom.uuid if new_record? }

    belongs_to :organization

    belongs_to :criterion, polymorphic: true, optional: true, dependent: :destroy,
      foreign_key: %i[ organization_id report_id criterion_id criterion_type ]

    belongs_to :report, class_name: "Jobshop::Inspection::Report",
      foreign_key: %i[ organization_id report_id ], inverse_of: :criteria

    delegate :ascii, :pass?, :random, :unit, to: :criterion
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
jobshop-0.0.167 app/models/jobshop/inspection/criterion.rb
jobshop-0.0.163 app/models/jobshop/inspection/criterion.rb