Create a gist now

Instantly share code, notes, and snippets.

[1] pry(#<RSpec::Core::ExampleGroup::Nested_1::Nested_2>)> create(:line_item)
(0.1ms) SAVEPOINT active_record_1
SQL (0.5ms) INSERT INTO "spree_users" ("authentication_token", "created_at", "email", "login", "updated_at") VALUES (?, ?, ?, ?, ?) [["authentication_token", "xxxx14028747076021xxxxxxxxxxxxx"], ["created_at", "2014-06-15 23:25:07.770910"], ["email", "marcus@beattyschaden.info"], ["login", "marcus@beattyschaden.info"], ["updated_at", "2014-06-15 23:25:07.770910"]]
(0.1ms) RELEASE SAVEPOINT active_record_1
Spree::Country Load (0.2ms) SELECT "spree_countries".* FROM "spree_countries" WHERE "spree_countries"."numcode" = 840 LIMIT 1
(0.1ms) SAVEPOINT active_record_1
SQL (1.0ms) INSERT INTO "spree_countries" ("iso", "iso3", "iso_name", "name", "numcode", "updated_at") VALUES (?, ?, ?, ?, ?, ?) [["iso", "US"], ["iso3", "USA"], ["iso_name", "UNITED STATES"], ["name", "United States of America"], ["numcode", 840], ["updated_at", "2014-06-15 23:25:07.843809"]]
(0.1ms) RELEASE SAVEPOINT active_record_1
(0.1ms) SAVEPOINT active_record_1
SQL (0.2ms) INSERT INTO "spree_states" ("abbr", "country_id", "name", "updated_at") VALUES (?, ?, ?, ?) [["abbr", "AL"], ["country_id", 1], ["name", "Alabama"], ["updated_at", "2014-06-15 23:25:07.850510"]]
(0.0ms) RELEASE SAVEPOINT active_record_1
(0.1ms) SAVEPOINT active_record_1
SQL (0.3ms) INSERT INTO "spree_addresses" ("address1", "address2", "alternative_phone", "city", "company", "country_id", "created_at", "firstname", "lastname", "phone", "state_id", "updated_at", "zipcode") VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?) [["address1", "10 Lovely Street"], ["address2", "Northwest"], ["alternative_phone", "123-456-7899"], ["city", "Herndon"], ["company", "Company"], ["country_id", 1], ["created_at", "2014-06-15 23:25:07.859706"], ["firstname", "John"], ["lastname", "Doe"], ["phone", "123-456-7890"], ["state_id", 1], ["updated_at", "2014-06-15 23:25:07.859706"], ["zipcode", "35005"]]
(0.1ms) RELEASE SAVEPOINT active_record_1
(0.1ms) SAVEPOINT active_record_1
Spree::Order Load (0.3ms) SELECT "spree_orders".* FROM "spree_orders" WHERE "spree_orders"."number" = 'R460154224' ORDER BY "spree_orders"."id" ASC LIMIT 1
(0.2ms) SELECT COUNT(*) FROM "spree_orders" WHERE (spree_orders.number LIKE 'R460154224%')
SQL (0.4ms) INSERT INTO "spree_orders" ("bill_address_id", "created_at", "currency", "email", "number", "state", "updated_at", "user_id") VALUES (?, ?, ?, ?, ?, ?, ?, ?) [["bill_address_id", 1], ["created_at", "2014-06-15 23:25:07.913363"], ["currency", "USD"], ["email", "marcus@beattyschaden.info"], ["number", "R460154224"], ["state", "cart"], ["updated_at", "2014-06-15 23:25:07.913363"], ["user_id", 1]]
Spree::TokenizedPermission Load (0.2ms) SELECT "spree_tokenized_permissions".* FROM "spree_tokenized_permissions" WHERE "spree_tokenized_permissions"."permissable_id" = ? AND "spree_tokenized_permissions"."permissable_type" = ? LIMIT 1 [["permissable_id", 1], ["permissable_type", "Spree::Order"]]
SQL (0.2ms) INSERT INTO "spree_tokenized_permissions" ("created_at", "permissable_id", "permissable_type", "token", "updated_at") VALUES (?, ?, ?, ?, ?) [["created_at", "2014-06-15 23:25:07.923980"], ["permissable_id", 1], ["permissable_type", "Spree::Order"], ["token", "33f0ab8a1fe27ec4"], ["updated_at", "2014-06-15 23:25:07.923980"]]
(0.1ms) RELEASE SAVEPOINT active_record_1
Spree::ShippingCategory Load (0.1ms) SELECT "spree_shipping_categories".* FROM "spree_shipping_categories" ORDER BY "spree_shipping_categories"."id" ASC LIMIT 1
(0.1ms) SAVEPOINT active_record_1
SQL (0.1ms) INSERT INTO "spree_shipping_categories" ("created_at", "name", "updated_at") VALUES (?, ?, ?) [["created_at", "2014-06-15 23:25:07.977084"], ["name", "ShippingCategory #1"], ["updated_at", "2014-06-15 23:25:07.977084"]]
(0.0ms) RELEASE SAVEPOINT active_record_1
Spree::TaxCategory Load (0.1ms) SELECT "spree_tax_categories".* FROM "spree_tax_categories" WHERE "spree_tax_categories"."deleted_at" IS NULL ORDER BY "spree_tax_categories"."id" ASC LIMIT 1
(0.1ms) SAVEPOINT active_record_1
Spree::TaxCategory Exists (0.1ms) SELECT 1 AS one FROM "spree_tax_categories" WHERE ("spree_tax_categories"."name" = 'TaxCategory - 810539' AND "spree_tax_categories"."deleted_at" IS NULL) LIMIT 1
SQL (0.3ms) INSERT INTO "spree_tax_categories" ("created_at", "description", "name", "updated_at") VALUES (?, ?, ?, ?) [["created_at", "2014-06-15 23:25:07.989318"], ["description", "Accusamus doloremque et rem voluptates impedit."], ["name", "TaxCategory - 810539"], ["updated_at", "2014-06-15 23:25:07.989318"]]
(0.1ms) RELEASE SAVEPOINT active_record_1
(0.1ms) SELECT COUNT(*) FROM "spree_stock_locations"
Spree::Country Load (0.1ms) SELECT "spree_countries".* FROM "spree_countries" ORDER BY "spree_countries"."id" ASC LIMIT 1
Spree::State Load (0.2ms) SELECT "spree_states".* FROM "spree_states" WHERE "spree_states"."country_id" = ? ORDER BY name ASC LIMIT 1 [["country_id", 1]]
(0.1ms) SAVEPOINT active_record_1
SQL (0.4ms) INSERT INTO "spree_stock_locations" ("address1", "backorderable_default", "city", "country_id", "created_at", "name", "phone", "state_id", "updated_at", "zipcode") VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?) [["address1", "1600 Pennsylvania Ave NW"], ["backorderable_default", "t"], ["city", "Washington"], ["country_id", 1], ["created_at", "2014-06-15 23:25:08.022983"], ["name", "NY Warehouse"], ["phone", "(202) 456-1111"], ["state_id", 1], ["updated_at", "2014-06-15 23:25:08.022983"], ["zipcode", "20500"]]
Spree::Variant Load (0.2ms) SELECT "spree_variants".* FROM "spree_variants" WHERE "spree_variants"."deleted_at" IS NULL ORDER BY "spree_variants"."id" ASC LIMIT 1000
(0.1ms) RELEASE SAVEPOINT active_record_1
(0.0ms) SAVEPOINT active_record_1
Spree::Product Exists (0.2ms) SELECT 1 AS one FROM "spree_products" WHERE ("spree_products"."id" IS NOT NULL) AND "spree_products"."slug" = 'product-1-3674' LIMIT 1
SQL (0.4ms) INSERT INTO "spree_products" ("available_on", "created_at", "description", "name", "shipping_category_id", "slug", "tax_category_id", "updated_at") VALUES (?, ?, ?, ?, ?, ?, ?, ?) [["available_on", "2013-06-15 23:25:07.972301"], ["created_at", "2014-06-15 23:25:08.114657"], ["description", "Voluptas molestias harum sequi ut nostrum deserunt occaecati error. Fuga repellat voluptatem repudiandae dignissimos quam. Non et id aspernatur alias architecto sit consequatur. Iure sint pariatur ea totam eum voluptatum omnis consectetur.\nAut quia dolorem ea sit numquam labore ea. Ipsa ut eaque quod laboriosam. Doloremque qui vel aut cum consequuntur quas. Quasi iste facilis assumenda ut."], ["name", "Product #1 - 3674"], ["shipping_category_id", 1], ["slug", "product-1-3674"], ["tax_category_id", 1], ["updated_at", "2014-06-15 23:25:08.114657"]]
SQL (0.4ms) INSERT INTO "spree_variants" ("cost_currency", "cost_price", "product_id", "sku", "updated_at") VALUES (?, ?, ?, ?, ?) [["cost_currency", "USD"], ["cost_price", 17.0], ["product_id", 1], ["sku", "ABC"], ["updated_at", "2014-06-15 23:25:08.118595"]]
Spree::Variant Load (0.2ms) SELECT "spree_variants".* FROM "spree_variants" WHERE "spree_variants"."id" = ? LIMIT 1 [["id", 1]]
SQL (0.2ms) INSERT INTO "spree_prices" ("amount", "currency", "variant_id") VALUES (?, ?, ?) [["amount", 19.99], ["currency", "USD"], ["variant_id", 1]]
SQL (0.1ms) UPDATE "spree_variants" SET "updated_at" = '2014-06-15 23:25:08.129096' WHERE "spree_variants"."id" = 1
Spree::Product Load (0.1ms) SELECT "spree_products".* FROM "spree_products" WHERE "spree_products"."id" = ? LIMIT 1 [["id", 1]]
SQL (0.1ms) UPDATE "spree_products" SET "updated_at" = '2014-06-15 23:25:08.131220' WHERE "spree_products"."id" = 1
Spree::Taxon Load (0.2ms) SELECT "spree_taxons".* FROM "spree_taxons" INNER JOIN "spree_products_taxons" ON "spree_taxons"."id" = "spree_products_taxons"."taxon_id" WHERE "spree_products_taxons"."product_id" = ? [["product_id", 1]]
SQL (0.1ms) UPDATE "spree_taxons" SET "updated_at" = '2014-06-15 23:25:08.146864' WHERE 1=0
SQL (0.2ms) UPDATE "spree_taxonomies" SET "updated_at" = '2014-06-15 23:25:08.148613' WHERE "spree_taxonomies"."id" IN (SELECT "spree_taxonomies"."id" FROM "spree_taxonomies" WHERE 1=0 ORDER BY spree_taxonomies.position)
Spree::StockLocation Load (0.1ms) SELECT "spree_stock_locations".* FROM "spree_stock_locations"
Spree::StockLocation Load (0.2ms) SELECT "spree_stock_locations".* FROM "spree_stock_locations" WHERE "spree_stock_locations"."id" = ? LIMIT 1 [["id", 1]]
Spree::StockItem Exists (0.1ms) SELECT 1 AS one FROM "spree_stock_items" WHERE ("spree_stock_items"."variant_id" = 1 AND "spree_stock_items"."stock_location_id" = 1 AND "spree_stock_items"."deleted_at" IS NULL) LIMIT 1
SQL (0.2ms) INSERT INTO "spree_stock_items" ("backorderable", "created_at", "stock_location_id", "updated_at", "variant_id") VALUES (?, ?, ?, ?, ?) [["backorderable", "t"], ["created_at", "2014-06-15 23:25:08.179942"], ["stock_location_id", 1], ["updated_at", "2014-06-15 23:25:08.179942"], ["variant_id", 1]]
SQL (0.1ms) UPDATE "spree_variants" SET "updated_at" = '2014-06-15 23:25:08.181558' WHERE "spree_variants"."id" = 1
SQL (0.1ms) UPDATE "spree_products" SET "updated_at" = '2014-06-15 23:25:08.182419' WHERE "spree_products"."id" = 1
Spree::Taxon Load (0.1ms) SELECT "spree_taxons".* FROM "spree_taxons" INNER JOIN "spree_products_taxons" ON "spree_taxons"."id" = "spree_products_taxons"."taxon_id" WHERE "spree_products_taxons"."product_id" = ? [["product_id", 1]]
SQL (0.1ms) UPDATE "spree_taxons" SET "updated_at" = '2014-06-15 23:25:08.184081' WHERE 1=0
SQL (0.1ms) UPDATE "spree_taxonomies" SET "updated_at" = '2014-06-15 23:25:08.184789' WHERE "spree_taxonomies"."id" IN (SELECT "spree_taxonomies"."id" FROM "spree_taxonomies" WHERE 1=0 ORDER BY spree_taxonomies.position)
(0.2ms) SELECT MAX("spree_variants"."position") AS max_id FROM "spree_variants" WHERE "spree_variants"."deleted_at" IS NULL AND "spree_variants"."product_id" = ? AND "spree_variants"."is_master" = 'f' [["product_id", 1]]
SQL (0.2ms) UPDATE "spree_variants" SET "position" = 1 WHERE "spree_variants"."id" = 1
(0.2ms) SELECT SUM("spree_stock_items"."count_on_hand") AS sum_id FROM "spree_stock_items" INNER JOIN "spree_stock_locations" ON "spree_stock_locations"."id" = "spree_stock_items"."stock_location_id" WHERE "spree_stock_items"."deleted_at" IS NULL AND "spree_stock_items"."variant_id" = 1 AND "spree_stock_locations"."active" = 't'
SQL (0.2ms) UPDATE "spree_products" SET "updated_at" = '2014-06-15 23:25:08.199672' WHERE "spree_products"."id" = 1
SQL (0.1ms) UPDATE "spree_taxons" SET "updated_at" = '2014-06-15 23:25:08.200667' WHERE 1=0
SQL (0.2ms) UPDATE "spree_taxonomies" SET "updated_at" = '2014-06-15 23:25:08.201465' WHERE "spree_taxonomies"."id" IN (SELECT "spree_taxonomies"."id" FROM "spree_taxonomies" WHERE 1=0 ORDER BY spree_taxonomies.position)
SQL (0.3ms) UPDATE "spree_variants" SET "is_master" = ?, "updated_at" = ? WHERE "spree_variants"."id" = 1 [["is_master", "t"], ["updated_at", "2014-06-15 23:25:08.203017"]]
SQL (0.2ms) UPDATE "spree_products" SET "updated_at" = '2014-06-15 23:25:08.205210' WHERE "spree_products"."id" = 1
SQL (0.1ms) UPDATE "spree_taxons" SET "updated_at" = '2014-06-15 23:25:08.206148' WHERE 1=0
SQL (0.1ms) UPDATE "spree_taxonomies" SET "updated_at" = '2014-06-15 23:25:08.206934' WHERE "spree_taxonomies"."id" IN (SELECT "spree_taxonomies"."id" FROM "spree_taxonomies" WHERE 1=0 ORDER BY spree_taxonomies.position)
SQL (0.1ms) UPDATE "spree_products" SET "updated_at" = '2014-06-15 23:25:08.207772' WHERE "spree_products"."id" = 1
SQL (0.1ms) UPDATE "spree_taxons" SET "updated_at" = '2014-06-15 23:25:08.208523' WHERE 1=0
SQL (0.2ms) UPDATE "spree_taxonomies" SET "updated_at" = '2014-06-15 23:25:08.209632' WHERE "spree_taxonomies"."id" IN (SELECT "spree_taxonomies"."id" FROM "spree_taxonomies" WHERE 1=0 ORDER BY spree_taxonomies.position)
(0.1ms) RELEASE SAVEPOINT active_record_1
(0.1ms) SAVEPOINT active_record_1
SQL (0.2ms) INSERT INTO "spree_option_types" ("created_at", "name", "presentation", "updated_at") VALUES (?, ?, ?, ?) [["created_at", "2014-06-15 23:25:08.226751"], ["name", "foo-size"], ["presentation", "Size"], ["updated_at", "2014-06-15 23:25:08.226751"]]
(0.0ms) RELEASE SAVEPOINT active_record_1
(0.1ms) SAVEPOINT active_record_1
Spree::OptionValue Load (0.2ms) SELECT "spree_option_values".* FROM "spree_option_values" WHERE (spree_option_values.position IS NOT NULL) AND ("spree_option_values"."option_type_id" = 1) ORDER BY spree_option_values.position DESC LIMIT 1
SQL (0.2ms) INSERT INTO "spree_option_values" ("created_at", "name", "option_type_id", "position", "presentation", "updated_at") VALUES (?, ?, ?, ?, ?, ?) [["created_at", "2014-06-15 23:25:08.249286"], ["name", "Size"], ["option_type_id", 1], ["position", 1], ["presentation", "S"], ["updated_at", "2014-06-15 23:25:08.249286"]]
SQL (0.1ms) UPDATE "spree_option_types" SET "updated_at" = '2014-06-15 23:25:08.251789' WHERE "spree_option_types"."id" = 1
Spree::Product Load (0.2ms) SELECT "spree_products".* FROM "spree_products" INNER JOIN "spree_product_option_types" ON "spree_products"."id" = "spree_product_option_types"."product_id" WHERE "spree_products"."deleted_at" IS NULL AND "spree_product_option_types"."option_type_id" = ? ORDER BY "spree_products"."id" ASC LIMIT 1000 [["option_type_id", 1]]
(0.1ms) RELEASE SAVEPOINT active_record_1
(0.1ms) SELECT COUNT(*) FROM "spree_stock_locations"
(0.1ms) SAVEPOINT active_record_1
SQL (0.2ms) INSERT INTO "spree_variants" ("cost_currency", "cost_price", "depth", "height", "product_id", "sku", "updated_at", "weight", "width") VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?) [["cost_currency", "USD"], ["cost_price", 17.0], ["depth", 184.28], ["height", 130.22], ["product_id", 1], ["sku", "9cd38a8464b9b69935ec8d8240453c97"], ["updated_at", "2014-06-15 23:25:08.275652"], ["weight", 63.38], ["width", 3.37]]
SQL (0.2ms) INSERT INTO "spree_option_values_variants" ("option_value_id", "variant_id") VALUES (?, ?) [["option_value_id", 1], ["variant_id", 2]]
Spree::Variant Load (0.1ms) SELECT "spree_variants".* FROM "spree_variants" WHERE "spree_variants"."id" = ? LIMIT 1 [["id", 2]]
SQL (0.1ms) INSERT INTO "spree_prices" ("amount", "currency", "variant_id") VALUES (?, ?, ?) [["amount", 19.99], ["currency", "USD"], ["variant_id", 2]]
SQL (0.1ms) UPDATE "spree_variants" SET "updated_at" = '2014-06-15 23:25:08.279982' WHERE "spree_variants"."id" = 2
Spree::Product Load (0.0ms) SELECT "spree_products".* FROM "spree_products" WHERE "spree_products"."id" = ? LIMIT 1 [["id", 1]]
SQL (0.1ms) UPDATE "spree_products" SET "updated_at" = '2014-06-15 23:25:08.281493' WHERE "spree_products"."id" = 1
Spree::Taxon Load (0.0ms) SELECT "spree_taxons".* FROM "spree_taxons" INNER JOIN "spree_products_taxons" ON "spree_taxons"."id" = "spree_products_taxons"."taxon_id" WHERE "spree_products_taxons"."product_id" = ? [["product_id", 1]]
SQL (0.1ms) UPDATE "spree_taxons" SET "updated_at" = '2014-06-15 23:25:08.283090' WHERE 1=0
SQL (0.2ms) UPDATE "spree_taxonomies" SET "updated_at" = '2014-06-15 23:25:08.283813' WHERE "spree_taxonomies"."id" IN (SELECT "spree_taxonomies"."id" FROM "spree_taxonomies" WHERE 1=0 ORDER BY spree_taxonomies.position)
Spree::StockLocation Load (0.1ms) SELECT "spree_stock_locations".* FROM "spree_stock_locations"
Spree::StockLocation Load (0.1ms) SELECT "spree_stock_locations".* FROM "spree_stock_locations" WHERE "spree_stock_locations"."id" = ? LIMIT 1 [["id", 1]]
Spree::StockItem Exists (0.1ms) SELECT 1 AS one FROM "spree_stock_items" WHERE ("spree_stock_items"."variant_id" = 2 AND "spree_stock_items"."stock_location_id" = 1 AND "spree_stock_items"."deleted_at" IS NULL) LIMIT 1
SQL (0.2ms) INSERT INTO "spree_stock_items" ("backorderable", "created_at", "stock_location_id", "updated_at", "variant_id") VALUES (?, ?, ?, ?, ?) [["backorderable", "t"], ["created_at", "2014-06-15 23:25:08.288257"], ["stock_location_id", 1], ["updated_at", "2014-06-15 23:25:08.288257"], ["variant_id", 2]]
SQL (0.1ms) UPDATE "spree_variants" SET "updated_at" = '2014-06-15 23:25:08.289576' WHERE "spree_variants"."id" = 2
SQL (0.1ms) UPDATE "spree_products" SET "updated_at" = '2014-06-15 23:25:08.290429' WHERE "spree_products"."id" = 1
SQL (0.1ms) UPDATE "spree_taxons" SET "updated_at" = '2014-06-15 23:25:08.291129' WHERE 1=0
SQL (0.1ms) UPDATE "spree_taxonomies" SET "updated_at" = '2014-06-15 23:25:08.291842' WHERE "spree_taxonomies"."id" IN (SELECT "spree_taxonomies"."id" FROM "spree_taxonomies" WHERE 1=0 ORDER BY spree_taxonomies.position)
(0.1ms) SELECT MAX("spree_variants"."position") AS max_id FROM "spree_variants" WHERE "spree_variants"."deleted_at" IS NULL AND "spree_variants"."product_id" = ? AND "spree_variants"."is_master" = 'f' [["product_id", 1]]
SQL (0.2ms) UPDATE "spree_variants" SET "position" = 1 WHERE "spree_variants"."id" = 2
SQL (0.2ms) UPDATE "spree_products" SET "updated_at" = '2014-06-15 23:25:08.294737' WHERE "spree_products"."id" = 1
SQL (0.1ms) UPDATE "spree_taxons" SET "updated_at" = '2014-06-15 23:25:08.295704' WHERE 1=0
SQL (0.2ms) UPDATE "spree_taxonomies" SET "updated_at" = '2014-06-15 23:25:08.296856' WHERE "spree_taxonomies"."id" IN (SELECT "spree_taxonomies"."id" FROM "spree_taxonomies" WHERE 1=0 ORDER BY spree_taxonomies.position)
(0.0ms) RELEASE SAVEPOINT active_record_1
(0.1ms) SAVEPOINT active_record_1
Spree::TaxCategory Load (0.2ms) SELECT "spree_tax_categories".* FROM "spree_tax_categories" WHERE "spree_tax_categories"."deleted_at" IS NULL AND "spree_tax_categories"."id" = ? LIMIT 1 [["id", 1]]
(0.2ms) SELECT SUM("spree_stock_items"."count_on_hand") AS sum_id FROM "spree_stock_items" INNER JOIN "spree_stock_locations" ON "spree_stock_locations"."id" = "spree_stock_items"."stock_location_id" WHERE "spree_stock_items"."deleted_at" IS NULL AND "spree_stock_items"."variant_id" = 2 AND "spree_stock_locations"."active" = 't'
Spree::StockItem Load (0.2ms) SELECT "spree_stock_items".* FROM "spree_stock_items" INNER JOIN "spree_stock_locations" ON "spree_stock_locations"."id" = "spree_stock_items"."stock_location_id" WHERE "spree_stock_items"."deleted_at" IS NULL AND "spree_stock_items"."variant_id" = 2 AND "spree_stock_locations"."active" = 't'
SQL (0.3ms) INSERT INTO "spree_line_items" ("cost_price", "created_at", "currency", "order_id", "price", "quantity", "tax_category_id", "updated_at", "variant_id") VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?) [["cost_price", 17.0], ["created_at", "2014-06-15 23:25:08.313417"], ["currency", "USD"], ["order_id", 1], ["price", 10.0], ["quantity", 1], ["tax_category_id", 1], ["updated_at", "2014-06-15 23:25:08.313417"], ["variant_id", 2]]
Spree::Zone Load (0.1ms) SELECT "spree_zones".* FROM "spree_zones" WHERE "spree_zones"."default_tax" = 't' ORDER BY "spree_zones"."id" ASC LIMIT 1
SQL (0.1ms) UPDATE "spree_orders" SET "updated_at" = '2014-06-15 23:25:08.317759' WHERE "spree_orders"."id" = 1
Spree::Zone Load (0.1ms) SELECT "spree_zones".* FROM "spree_zones" WHERE "spree_zones"."default_tax" = 't' ORDER BY "spree_zones"."id" ASC LIMIT 1
Spree::LineItem Load (0.2ms) SELECT "spree_line_items".* FROM "spree_line_items" WHERE "spree_line_items"."id" = ? LIMIT 1 [["id", 1]]
Spree::Adjustment Load (0.1ms) SELECT "spree_adjustments".* FROM "spree_adjustments" WHERE "spree_adjustments"."adjustable_id" = ? AND "spree_adjustments"."adjustable_type" = ? AND "spree_adjustments"."source_type" = 'Spree::PromotionAction' [["adjustable_id", 1], ["adjustable_type", "Spree::LineItem"]]
Spree::Adjustment Load (0.2ms) SELECT "spree_adjustments".* FROM "spree_adjustments" WHERE "spree_adjustments"."adjustable_id" = ? AND "spree_adjustments"."adjustable_type" = ? AND "spree_adjustments"."source_type" = 'Spree::PromotionAction' AND "spree_adjustments"."eligible" = 't' ORDER BY amount ASC, created_at DESC LIMIT 1 [["adjustable_id", 1], ["adjustable_type", "Spree::LineItem"]]
Spree::Adjustment Load (0.1ms) SELECT "spree_adjustments".* FROM "spree_adjustments" WHERE "spree_adjustments"."adjustable_id" = ? AND "spree_adjustments"."adjustable_type" = ? AND "spree_adjustments"."source_type" = 'Spree::TaxRate' AND "spree_adjustments"."included" = 't' [["adjustable_id", 1], ["adjustable_type", "Spree::LineItem"]]
Spree::Adjustment Load (0.1ms) SELECT "spree_adjustments".* FROM "spree_adjustments" WHERE "spree_adjustments"."adjustable_id" = ? AND "spree_adjustments"."adjustable_type" = ? AND "spree_adjustments"."source_type" = 'Spree::TaxRate' AND "spree_adjustments"."included" = 'f' [["adjustable_id", 1], ["adjustable_type", "Spree::LineItem"]]
SQL (0.1ms) UPDATE "spree_line_items" SET "promo_total" = 0.0, "included_tax_total" = 0, "additional_tax_total" = 0, "adjustment_total" = 0.0, "updated_at" = '2014-06-15 23:25:08.331023' WHERE "spree_line_items"."id" = 1
(0.0ms) RELEASE SAVEPOINT active_record_1
=> #<Spree::LineItem id: 1, variant_id: 2, order_id: 1, quantity: 1, price: #<BigDecimal: 10.0>, created_at: "2014-06-15 23:25:08", updated_at: "2014-06-15 23:25:08", currency: "USD", cost_price: #<BigDecimal: 17.0>, tax_category_id: 1, adjustment_total: #<BigDecimal: 0.0>, additional_tax_total: #<BigDecimal: 0.0>, promo_total: #<BigDecimal: 0.0>, included_tax_total: #<BigDecimal: 0.0>, pre_tax_amount: nil>
@hlegius
hlegius commented Jun 16, 2014

mother of god

Mother of Active Record Relations :O

@joneslee85

It makes things simple for beginners but extremely hard for experienced devs

@jhawthorn

I tried annotating the SQL in the hope that it will help explain what is going on and some obvious areas of improvement.

https://gist.github.com/jhawthorn/37723788edfe2cea07fc

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment