Skip to content

Commit

Permalink
Drop duplicated find for shipping category
Browse files Browse the repository at this point in the history
The default shipping category already gets predefined at the beginning of the script, hence this second lookup that happens on every product creation is not necessary.
  • Loading branch information
pusewicz committed Dec 9, 2015
1 parent c9ef429 commit 30bdf43
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions sample/db/samples/products.rb
Original file line number Diff line number Diff line change
Expand Up @@ -78,12 +78,11 @@
eur_price = product_attrs.delete(:eur_price)
Spree::Config[:currency] = "USD"

default_shipping_category = Spree::ShippingCategory.find_by_name!("Default")
product = Spree::Product.create!(default_attrs.merge(product_attrs))
Spree::Config[:currency] = "EUR"
product.reload
product.price = eur_price
product.shipping_category = default_shipping_category
product.shipping_category = shipping_category
product.save!
end

Expand Down

0 comments on commit 30bdf43

Please sign in to comment.