Sha256: 10e2dfcbbd824372b1a5cc0843edfebaac1ce7b7cc4b46402c6f0bd01a760946

Contents?: true

Size: 702 Bytes

Versions: 1

Compression:

Stored size: 702 Bytes

Contents

module Jobshop
  class RoutingProcess < ApplicationRecord
    self.primary_keys = [ :organization_id, :routing_process_id ]

    after_create do
      self.class.connection.clear_query_cache
      @attributes = self.class.unscoped {
        self.class.find_by!(organization: organization, product_id: product_id)
      }.instance_variable_get(:@attributes)
      @new_record = false
      self
    end

    belongs_to :organization, inverse_of: :routing_processes
    belongs_to :product, inverse_of: :routing_process,
      foreign_key: [ :organization_id, :product_id ]
    has_many :routing_steps, inverse_of: :routing_process,
      foreign_key: [ :organization_id, :routing_process_id ]
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
jobshop-0.0.157 app/models/jobshop/routing_process.rb