db/samples/shipping_methods.rb in spree_sample-3.5.0 vs db/samples/shipping_methods.rb in spree_sample-3.6.0.rc1
- old
+ new
@@ -1,43 +1,43 @@
begin
- north_america = Spree::Zone.find_by!(name: "North America")
+ north_america = Spree::Zone.find_by!(name: 'North America')
rescue ActiveRecord::RecordNotFound
- puts "Couldn't find 'North America' zone. Did you run `rake db:seed` first?"
- puts "That task will set up the countries, states and zones required for Spree."
+ puts 'Couldn\'t find \'North America\' zone. Did you run `rake db:seed` first?'
+ puts 'That task will set up the countries, states and zones required for Spree.'
exit
end
-europe_vat = Spree::Zone.find_by!(name: "EU_VAT")
+europe_vat = Spree::Zone.find_by!(name: 'EU_VAT')
shipping_category = Spree::ShippingCategory.find_or_create_by!(name: 'Default')
shipping_methods = [
{
- name: "UPS Ground (USD)",
+ name: 'UPS Ground (USD)',
zones: [north_america],
display_on: 'both',
shipping_categories: [shipping_category]
},
{
- name: "UPS Two Day (USD)",
+ name: 'UPS Two Day (USD)',
zones: [north_america],
display_on: 'both',
shipping_categories: [shipping_category]
},
{
- name: "UPS One Day (USD)",
+ name: 'UPS One Day (USD)',
zones: [north_america],
display_on: 'both',
shipping_categories: [shipping_category]
},
{
- name: "UPS Ground (EU)",
+ name: 'UPS Ground (EU)',
zones: [europe_vat],
display_on: 'both',
shipping_categories: [shipping_category]
},
{
- name: "UPS Ground (EUR)",
+ name: 'UPS Ground (EUR)',
zones: [europe_vat],
display_on: 'both',
shipping_categories: [shipping_category]
}
]
@@ -50,14 +50,14 @@
shipping_method.shipping_categories = attributes[:shipping_categories]
end
end
{
- "UPS Ground (USD)" => [5, "USD"],
- "UPS Ground (EU)" => [5, "USD"],
- "UPS One Day (USD)" => [15, "USD"],
- "UPS Two Day (USD)" => [10, "USD"],
- "UPS Ground (EUR)" => [8, "EUR"]
+ 'UPS Ground (USD)' => [5, 'USD'],
+ 'UPS Ground (EU)' => [5, 'USD'],
+ 'UPS One Day (USD)' => [15, '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.preferences = {
amount: price,
currency: currency