Skip to content

Instantly share code, notes, and snippets.

@mayra-cabrera
Last active December 29, 2015 01:18
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mayra-cabrera/7591664 to your computer and use it in GitHub Desktop.
Save mayra-cabrera/7591664 to your computer and use it in GitHub Desktop.
#Product, Variants & Parts
Spree::Product.find(42)
=> #<Spree::Product id: 42, name: "Manager & Supervisor Due Diligence", course_id: 3....>
Spree::Product.find(42).parts
=> [#<Spree::Variant id: 14, sku: "C3", .. is_master: true, product_id: 12, course_id: nil...>,
#<Spree::Variant id: 46, sku: "Confined-2", ... is_master: false, product_id: 11, course_id: nil...>
Spree::AssembliesPart.where(assemblie_id: 42)
=> [#<Spree::AssembliesPart assembly_id: 42, part_id: 14, count: 2>,
#<Spree::AssembliesPart assembly_id: 42, part_id: 46, count: 2>]
#Order
Spree::Order.last
=>#<Spree::Order id: 10484, number: "10484"
Spree::Order.last.line_items.first.variant
=> => #<Spree::Variant id: 47, sku: "M11", is_master: true, product_id: 42, course_id: nil...>
#Se crea el InventoryOrder
InventoryOrder.find(1322)
=> #<InventoryOrder id: 1322, from_account_id: 8058, to_account_id: 199, order_id: 10484...>
# El unit del line item original
InventoryOrder.find(1322).inventory_line_items
=> [#<InventoryLineItem id: 1028, inventory_order_id: 1322, course_id: 3, qty: 1, variant_id: 47>]
¿Por cada parte se tendría que crear un inventory order asociado al curso original o al curso de cada variant?
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment