Sha256: 1ace9db0493f61662ac5120db288a5c55c89926ea86ea5e0272a66ac3a8581ec

Contents?: true

Size: 480 Bytes

Versions: 1

Compression:

Stored size: 480 Bytes

Contents

# frozen_string_literals: true

module Jobshop
  class Product < ApplicationRecord
    self.primary_keys = %i[ organization_id product_id ]

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

    belongs_to :organization, inverse_of: :products

    has_one :routing_process, inverse_of: :product,
      foreign_key: %i[ organization_id product_id ]

    has_many :routing_steps, through: :routing_process

    validates :name, presence: true
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
jobshop-0.0.167 app/models/jobshop/product.rb