Sha256: 711d5d09e3c8db679d01727e68ea42d15289340cb8244c56a3068179e2b8616f
Contents?: true
Size: 814 Bytes
Versions: 2
Compression:
Stored size: 814 Bytes
Contents
module Spree class AssembliesPart < ActiveRecord::Base belongs_to :assembly, class_name: "Spree::Product", foreign_key: "assembly_id", touch: true belongs_to :part, class_name: "Spree::Variant", foreign_key: "part_id" delegate :name, :sku, to: :part after_create :set_master_unlimited_stock def self.get(assembly_id, part_id) find_or_initialize_by(assembly_id: assembly_id, part_id: part_id) end def options_text if variant_selection_deferred? Spree.t(:user_selectable) else part.options_text end end private def set_master_unlimited_stock if part.product.variants.any? part.product.master.update_attribute :track_inventory, false end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
solidus_product_bundle-1.0.1 | app/models/spree/assemblies_part.rb |
solidus_product_bundle-1.0.0 | app/models/spree/assemblies_part.rb |