From d61447d9c4540de3c467485e9fbda5d088fe6532 Mon Sep 17 00:00:00 2001 From: Jeff Dutil Date: Thu, 8 Jan 2015 14:11:40 -0500 Subject: [PATCH] Add mysql2 for ci, and raise errors in product handler for failed create calls. --- Gemfile | 1 + lib/spree/wombat/handler/product_handler_base.rb | 6 +++--- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/Gemfile b/Gemfile index 162d4c0..6f3f083 100644 --- a/Gemfile +++ b/Gemfile @@ -5,6 +5,7 @@ gem 'spree', github: 'spree/spree', branch: "master" gem 'coffee-rails', '~> 4.0.0' gem 'sass-rails', '~> 4.0.0' +gem 'mysql2' gem 'pg' group :test do diff --git a/lib/spree/wombat/handler/product_handler_base.rb b/lib/spree/wombat/handler/product_handler_base.rb index db1259e..9c3f6f4 100644 --- a/lib/spree/wombat/handler/product_handler_base.rb +++ b/lib/spree/wombat/handler/product_handler_base.rb @@ -90,12 +90,12 @@ def add_taxon(parent, taxon_names, position = 0) if taxon parent.children << taxon else - taxon = parent.children.create(name: taxon_name, position: position) + taxon = parent.children.create!(name: taxon_name, position: position) end parent.save # store the taxon so we can assign it later @taxon_ids << taxon.id - add_taxon(taxon, taxon_names, position+1) + add_taxon(taxon, taxon_names, position + 1) end def process_images(variant, images) @@ -125,7 +125,7 @@ def process_child_products(product, children) if variant variant.update_attributes(child_product) else - variant = product.variants.create({ product: product }.merge(child_product)) + variant = product.variants.create!({ product: product }.merge(child_product)) end process_images(variant, images) end