Last active
December 29, 2015 00:29
-
-
Save mayra-cabrera/7586523 to your computer and use it in GitHub Desktop.
Parts!
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Spree::Product.find(10).assembly? | |
Spree::Product Load (0.9ms) SELECT "spree_products".* FROM "spree_products" WHERE "spree_products"."id" = $1 LIMIT 1 [["id", 10]] | |
Spree::Variant Load (0.9ms) SELECT "spree_variants".* FROM "spree_variants" INNER JOIN "spree_assemblies_parts" ON "spree_variants"."id" = "spree_assemblies_parts"."part_id" WHERE "spree_assemblies_parts"."assembly_id" = 10 | |
=> true | |
Spree::Product.find(10).parts | |
Spree::Product Load (1.1ms) SELECT "spree_products".* FROM "spree_products" WHERE "spree_products"."id" = $1 LIMIT 1 [["id", 10]] | |
Spree::Variant Load (0.7ms) SELECT "spree_variants".* FROM "spree_variants" INNER JOIN "spree_assemblies_parts" ON "spree_variants"."id" = "spree_assemblies_parts"."part_id" WHERE "spree_assemblies_parts"."assembly_id" = 10 | |
=> [#<Spree::Variant id: 14, sku: "C3", price: #<BigDecimal:7fd289b39148,'0.7495E2',18(18)>, weight: nil, height: nil, width: nil, depth: nil, deleted_at: nil, is_master: true, product_id: 12, count_on_hand: -425, cost_price: #<BigDecimal:7fd289b37ff0,'0.0',9(18)>, position: nil, course_id: nil>, | |
#<Spree::Variant id: 13, sku: "C55", price: #<BigDecimal:7fd289b373c0,'0.3295E2',18(18)>, weight: nil, height: nil, width: nil, depth: nil, deleted_at: nil, is_master: true, product_id: 11, count_on_hand: -1081, cost_price: #<BigDecimal:7fd286446af0,'0.0',9(18)>, position: nil, course_id: nil>] | |
Spree::AssembliesPart.all | |
Spree::AssembliesPart Load (0.4ms) SELECT "spree_assemblies_parts".* FROM "spree_assemblies_parts" | |
=> [#<Spree::AssembliesPart assembly_id: 10, part_id: 14, count: 2>, | |
#<Spree::AssembliesPart assembly_id: 10, part_id: 13, count: 2>] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment