diff --git a/db/default/zones.rb b/db/default/zones.rb index 19d04ca090..10dd53b1d2 100644 --- a/db/default/zones.rb +++ b/db/default/zones.rb @@ -1,15 +1,19 @@ -eu_vat = Spree::Zone.create!(name: "EU_VAT", description: "Countries that make up the EU VAT zone.") -north_america = Spree::Zone.create!(name: "North America", description: "USA + Canada") +unless Spree::Zone.find_by(name: "EU_VAT") + eu_vat = Spree::Zone.create!(name: "EU_VAT", description: "Countries that make up the EU VAT zone.") -["Poland", "Finland", "Portugal", "Romania", "Germany", "France", - "Slovakia", "Hungary", "Slovenia", "Ireland", "Austria", "Spain", - "Italy", "Belgium", "Sweden", "Latvia", "Bulgaria", "United Kingdom", - "Lithuania", "Cyprus", "Luxembourg", "Malta", "Denmark", "Netherlands", - "Estonia"]. -each do |name| - eu_vat.zone_members.create!(zoneable: Spree::Country.find_by!(name: name)) + ["Poland", "Finland", "Portugal", "Romania", "Germany", "France", + "Slovakia", "Hungary", "Slovenia", "Ireland", "Austria", "Spain", + "Italy", "Belgium", "Sweden", "Latvia", "Bulgaria", "United Kingdom", + "Lithuania", "Cyprus", "Luxembourg", "Malta", "Denmark", "Netherlands", + "Estonia"].each do |name| + eu_vat.zone_members.create!(zoneable: Spree::Country.find_by!(name: name)) + end end -["United States", "Canada"].each do |name| - north_america.zone_members.create!(zoneable: Spree::Country.find_by!(name: name)) +unless Spree::Zone.find_by(name: "North America") + north_america = Spree::Zone.create!(name: "North America", description: "USA + Canada") + + ["United States", "Canada"].each do |name| + north_america.zone_members.create!(zoneable: Spree::Country.find_by!(name: name)) + end end