db/samples/shipping_methods.rb in spree_sample-2.1.3 vs db/samples/shipping_methods.rb in spree_sample-2.1.4

- old
+ new

@@ -7,11 +7,11 @@ end europe_vat = Spree::Zone.find_by_name!("EU_VAT") shipping_category = Spree::ShippingCategory.find_or_create_by!(name: 'Default') -shipping_methods = [ +Spree::ShippingMethod.create!([ { :name => "UPS Ground (USD)", :zones => [north_america], :calculator => Spree::Calculator::Shipping::FlatRate.create!, :shipping_categories => [shipping_category] @@ -27,29 +27,31 @@ :zones => [north_america], :calculator => Spree::Calculator::Shipping::FlatRate.create!, :shipping_categories => [shipping_category] }, { + :name => "UPS Ground (EU)", + :zones => [europe_vat], + :calculator => Spree::Calculator::Shipping::FlatRate.create!, + :shipping_categories => [shipping_category] + }, + { :name => "UPS Ground (EUR)", :zones => [europe_vat], :calculator => Spree::Calculator::Shipping::FlatRate.create!, :shipping_categories => [shipping_category] } -] +]) -shipping_methods.each do |shipping_method_attrs| - Spree::ShippingMethod.create!(shipping_method_attrs) -end - { "UPS Ground (USD)" => [5, "USD"], - "UPS Ground (EUR)" => [5, "EUR"], + "UPS Ground (EU)" => [5, "USD"], "UPS One Day (USD)" => [15, "USD"], - "UPS Two Day (USD)" => [10, "USD"] + "UPS Two Day (USD)" => [10, "USD"], + "UPS Ground (EUR)" => [8, "EUR"] }.each do |shipping_method_name, (price, currency)| shipping_method = Spree::ShippingMethod.find_by_name!(shipping_method_name) shipping_method.calculator.preferred_amount = price shipping_method.calculator.preferred_currency = currency - shipping_method.shipping_categories << Spree::ShippingCategory.first shipping_method.save! end