Sha256: f1158e35d1f9d1fda407be1922b430977f49b8fa8828ecbe56d5ed58948fd9f3

Contents?: true

Size: 453 Bytes

Versions: 1

Compression:

Stored size: 453 Bytes

Contents

# frozen_string_literals: true

module Jobshop
  class OrderLine < ApplicationRecord
    self.primary_keys = %i[ organization_id order_id order_line_id ]

    after_initialize { self.order_line_id ||= SecureRandom.hex if new_record? }

    belongs_to :organization

    belongs_to :order, inverse_of: :order_lines,
      foreign_key: %i[ organization_id order_id ]

    belongs_to :product,
      foreign_key: %i[ organization_id product_id ]
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

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