Sha256: 6354a58985ac6036eefd7753725ffff51a94a41418c714e5730682f5aac4f7f1

Contents?: true

Size: 415 Bytes

Versions: 4

Compression:

Stored size: 415 Bytes

Contents

# frozen_string_literal: true

module Spree
  class AssembliesPart < ApplicationRecord
    belongs_to :assembly, class_name: "Spree::Product",
                          foreign_key: "assembly_id", touch: true

    belongs_to :part, class_name: "Spree::Variant", foreign_key: "part_id"

    def self.get(assembly_id, part_id)
      find_or_initialize_by(assembly_id: assembly_id, part_id: part_id)
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
solidus_product_assembly-1.4.0 app/models/spree/assemblies_part.rb
solidus_product_assembly-1.3.0 app/models/spree/assemblies_part.rb
solidus_product_assembly-1.2.0 app/models/spree/assemblies_part.rb
solidus_product_assembly-1.1.0 app/models/spree/assemblies_part.rb