Sha256: 4e02275d6d5bf8095d62179d15c5b8136ea29545e24bb6f53ac9c1ddae82e6b1
Contents?: true
Size: 592 Bytes
Versions: 4
Compression:
Stored size: 592 Bytes
Contents
# frozen_string_literal: true module SolidusProductAssembly module Spree module VariantDecorator def self.prepended(base) base.class_eval do has_and_belongs_to_many :assemblies, class_name: "Spree::Product", join_table: "spree_assemblies_parts", foreign_key: "part_id", association_foreign_key: "assembly_id" end end def assemblies_for(products) assemblies.where(id: products) end def part? assemblies.exists? end ::Spree::Variant.prepend self end end end
Version data entries
4 entries across 4 versions & 1 rubygems